Will this do the job?

Will this code control a servo like this video?

/*
   Read the Memsic 2125 two-axis accelerometer.  Converts the
   pulses output by the 2125 into milli-g's (1/1000 of earth's
   gravity) and prints them over the serial connection to the
   computer. Controlls a servos position using the accelerometer. 
   
   The circuit:
	* X output of accelerometer to digital pin 2
	* Y output of accelerometer to digital pin 3
	* +V of accelerometer to +5V
	* GND of accelerometer to ground
 */

// these constants won't change:
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 
const int xPin = 2;		// X output of the accelerometer
const int yPin = 3;		// Y output of the accelerometer
int xPin=2;  // analog pin used to connect the x axis of the acclerometer
int yPin=3;  // analog pin used to connect the y axis of the accelerometer
int val;    // variable to read the value from the analog pin 

void setup() {
  
  // initialize the pins connected to the accelerometer
  // as inputs:
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
}

void loop() {
  // variables to read the pulse widths:
  int pulseX, pulseY;
  // variables to contain the resulting accelerations
  int accelerationX, accelerationY;
  
  // read pulse from x- and y-axes:
  pulseX = pulseIn(xPin,HIGH);  
  pulseY = pulseIn(yPin,HIGH);
  
  // convert the pulse width into acceleration
  // accelerationX and accelerationY are in milli-g's: 
  // earth's gravity is 1000 milli-g's, or 1g.
  accelerationX = ((pulseX / 10) - 500) * 8;
  accelerationY = ((pulseY / 10) - 500) * 8;
  val = analogRead(xpin);            // reads the value of the x axis output (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  delay(2);                           // waits for the servo to get there 

}

Will this code control a servo like this video?

You've got the code. You've got the hardware. You've watched the video. Did the code do what you wanted?

A friend did it and it works fine with him, so sure it will work with you.
But be careful and do it smart..