Skip to content

Instantly share code, notes, and snippets.

sudo date -s "$(wget -S "http://www.google.com/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
@v-thomp4
v-thomp4 / gist:8c4efc9b1480495e772f31e3f343128b
Created July 14, 2020 07:42
Set Time, Date Timezone in Linux from Command Line
Set date from the command line
date +%Y%m%d -s "20120418"
Set time from the command line
date +%T -s "11:14:00"
Set time and date from the command line
date -s "19 APR 2012 11:14:00"
htpasswd -Bbn user pass > auth/htpasswd
docker run -it -d --restart=unless-stopped \
-p 5000:5000 --name registry -v "$(pwd)"/auth:/auth \
-e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2
```
adb tcpip 5555
adb connect 192.168.1.2:5555
adb connect 192.168.1.3:5555
```
adb devices -l
List of devices attached
10.111.195.156:5556 device product:1
10.111.195.157:5557 device product:2
list.txt
~/.ssh/config
Match Originalhost server-a Exec "ifconfig | grep 192.168.1"
Hostname 192.168.1.100
User foo
Port 2222
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Host server-a
HostName ngrok.example.com
User bar
@v-thomp4
v-thomp4 / parted.txt
Created June 4, 2020 10:35
Linux Creating a Partition Size Larger Than 2TB
$ ./parted_mkpart_calc.sh sda
Using default 1 MiB default alignment in calc
Calculated alignment for /dev/sda (gpt) is: 2048s
If you would be root, you could create partition with:
# parted /dev/sda mkpart [name] [type] 2048s 2930276351s
Verify partition alignment with:
# parted /dev/sda align-check optimal 1 Should return: 1 aligned
parted /dev/sda mkpart LVM ext4 2048s 2930276351s
@v-thomp4
v-thomp4 / gist:07911b1a7ab2aa3169c75c3663ad370e
Created June 4, 2020 09:57
force update timezone Jenkins docker
Go to http://jenkins.local.host/script
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Ho_Chi_Minh')
@v-thomp4
v-thomp4 / gist:3682cad7170e6b7b4df4261e82d421ba
Last active April 12, 2020 11:40
disable explore gitlab
cd /opt/gitlab/embedded/service/gitlab-rails/app/controllers
cp application_controller.rb application_controller.rb.orig
vim application_controller.rb
...
before_action :force_authenticated_user!
...
def force_authenticated_user!(*args)
if (!current_user) and (["/explore", "/help"].include?(request.path))
redirect_to new_user_session_path and return
end
@v-thomp4
v-thomp4 / gist:ea03941c009baf47b48d733aab317f43
Created February 24, 2020 10:30
Fix No Wi-Fi Adapter Found ubuntu 18.04
sudo apt-get install --reinstall bcmwl-kernel-source
@v-thomp4
v-thomp4 / gist:9d67275c102e3fe44453a8ac0e39b2d4
Created February 21, 2020 04:44
config http_proxy gitlab-ce
gitlab_rails['env'] = {
"http_proxy" => "http://proxy.example.com:9090",
"https_proxy" => "http://proxy.example.com:9090"
# "no_proxy" => ".yourdomain.com" # Wildcard syntax if you need your internal domain to bypass proxy
}
# Needed for proxying Git clones
gitaly['env'] = {
"http_proxy" => "http://proxy.example.com:9090",
"https_proxy" => "http://proxy.example.com:9090",
"no_proxy" => "unix" # Workaround for https://gitlab.com/gitlab-org/gitaly/issues/1447