Using git clone without direct internet connection

I have a new (to me) Dell desktop, on which I have successfully installed Ubuntu Desktop 18.4 LTS. This computer has no DVD and no wireless network card.

I believe I have found the proper drivers to load for the Netgear USB WiFi adapter (A6100 AC600) which I have acquired. However, with no direct internet connection yet, I don’t know how to acquire those drivers.

There is internet access through an old iMac.

How can I do the equivalent of a “git clone” on that Mac, move the drivers to a USB, and then install those drivers on the Dell?

Pygame Flappy Bird Clone Black Screen

I am new to coding python, and I followed everything in a 4hr video tutorial but however, I get a black screen when I run my game. I am trying to finish this game for my long-term-project in high-school. I greatly appreciate everyone who helps me with my code.

Here is my code:

    import pygame import time from random import randint,randrange  black = (0,0,0) white = (255,255,255)  sunset = (253,72,47)  greenyellow = (184,255,0) brightblue = (47,228,253) orange = (255,113,0) yellow = (255,236,0) purple = (252,67,255)  colorChoices = [greenyellow,brightblue,orange,yellow,purple]  pygame.init()  surfaceWidth = 800 surfaceHeight = 500  imageHeight = 43 imageWidth = 100  surface = pygame.display.set_mode((surfaceWidth,surfaceHeight)) pygame.display.set_caption('Helicopter') clock = pygame.time.Clock()  img = pygame.image.load('helicopterbettersized.png')  def score(count):     font = pygame.font.Font('freesansbold.ttf', 20)     text = font.render("Score: "+str(count), True, white)     surface.blit(text, [0,0])  def blocks(x_block, y_block, block_width, block_height, gap, colorChoice):      pygame.draw.rect(surface, colorChoice, [x_block,y_block,block_width,block_height])     pygame.draw.rect(surface, colorChoice, [x_block,y_block_block_height+gap,block_width, surfaceHeight])   def replay_or_quit():     for event in pygame.event.get ([pygame.KEYDOWN, pygame.KEYUP, pygame.QUIT]):         if event.type == pygame.QUIT:             pygame.quit()             quit()          elif event.type == pygame.KEYDOWN:             continue          return event.key      return None  def makeTextObjs(text, font):     textSurface = font.render(text, True, sunset)     return textSurface, textSurface.get_rect()  def msgSurface(text):     smallText = pygame.font.Font('freesansbold.ttf', 20)     largeText = pygame.font.Font('freesansbold.ttf', 150)      titleTextSurf, titleTextRect = makeTextObjs(text, largeText) = surfaceWidth / 2, surfaceHeight / 2     surface.blit(titleTextSurf, titleTextRect)      typTextSurf, typTextRect = makeTextObjs('Press any key to continue', smallText) = surfaceWidth / 2, ((surfaceHeight / 2) + 100)     surface.blit(typTextSurf, typTextRect)      pygame.display.update()     time.sleep(1)      while replay_or_quit() == None:         clock.tick()      main()   def gameOver():     msgSurface('Kaboom!')   def helicopter(x, y, image):     surface.blit(img, (x,y))   def main():     x = 150     y = 200     y_move = 0      x_block = surfaceWidth     y_block = 0      block_width = 75     block_height = randint (0,surfaceHeight/2)     gap = imageHeight * 3     block_move = 4      current_score = 0       blockColor = colorChoices[randrange(0,len(colorChoices))]      game_over = False      while not game_over:          for event in pygame.event.get():             if event.type == pygame.QUIT:                 game_over = True          if event.type == pygame.KEYDOWN:             if event.key == pygame.K_UP:                 y_move = -5              if event.type == pygame.KEYUP:                 if event.key == pygame.K_UP:                     y_move = 5          y += y_move          surface.fill(black)         helicopter(x ,y, img)           blocks(x_block, y_block, block_width, block_height, gap, blockColor)         score(current_score)         x_block -= block_move          if y > surfaceHeight-40 or y < 0:             gameOver()          if x_block < (-1*block_width):             x_block = surfaceWidth             block_height = randint(0,(surfaceHeight / 2))             blockColor = colorChoices[randrange(0,len(colorChoices))]             current_score+=1          if x + imageWidth > x_block:             if x < x_block + block_width:                 if y < block_height:                     if x - imageWidth < block_width + x_block:                       gameOver()              if x + imageWidth > x_block:                 if y + imageHeight > block_height+gap:                     if x < block_width + x_block:                         gameOver()             # if x_block < (x - block_width) < x_block + block_move + block_move:            #     current_score += 1              if 3 <= current_score <5:                 block_move = 5                 gap = imageHeight * 2.9             if 5 <= current_score < 8:                 block_move = 6                 gap = imageHeight *2.8             if 8<= current_score < 14:                 block_move = 7                 gap = imageHeight *2.7               pygame.display.update()         clock.tick(60)  main() pygame.quit() quit() 

Clone Vector in rust except at one index

Let’s consider you want to clone all items of a vector orig except the item of index i should be taken from alternative value alt.

Lets say the items are of the type

struct Bla{   // Some fields } 

Using for loop

On simple solution would be:

fn clone(orig: &Vec<Bla>, i: usize, alt: Bla) -> Vec<Bla> {   let cloned = Vec::new();   for (j, item) in orig.iter().enumerate() {     let new_item = if i != j {item.clone()} else {alt};     cloned.push(new_item);   }      cloned } 

Note: Does not compile, because the compiler does not know that i==j is only valid once.

Using functional style

The functional alternative would be the follow:

fn clone(orig: &Vec<Bla>, i: usize, alt: Bla) -> Vec<Bla> {   orig.iter().enumerate()     .map(|(j, item)| if i != j {item.clone()} else {alt})     .collect::<Vec<Bla>>() } 

The last one looks nice, but does not compile 🙁 because the rust compiler does not know that alt gets moved (or consumed) only once (i==j).

Using mem replace

In order to fix the version above one can use a default value for the index which should be replaced.

fn clone(orig: &Vec<Bla>, i: usize, alt: Bla) -> Vec<Bla> {   let mut result = orig.iter().enumerate()     .map(|(j, item)| if i != j {item.clone()} else {Bla::default()})     .collect::<Vec<Bla>>();    mem::replace(&mut result[i], alt);   result } 

What is the most concise and fastest implementation to do so?

With password, how find the passphrase for a full disk encryption after a clone

  1. I first installed Xubuntu 18.04 with full disk encryption with the default option; I remember the password, but lost the passphrase accidently.
  2. I cloned my original disk with clonezilla to a new disk;

Now I want to recover the passphrase for the new disk, and would like to know if it is possible?