Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
@kkkkke
kkkkke / ssh-agent-autostart.sh
Created April 15, 2017 11:52 — forked from NeuronQ/ssh-agent-autostart.sh
ssh-agent autostart (bash) - add this to .bashrc
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@kkkkke
kkkkke / gist:ce5179f348697f0981c3ff00ba73c89f
Created April 20, 2017 18:38 — forked from wpivotto/gist:3993502
Maximize VMWare images performance
Insert the following code into the *.VMX file:
sched.mem.pshare.enable = "FALSE"
mainMem.useNamedFile = "FALSE"
prefvmx.minVmMemPct = "100"
prefvmx.useRecommendedLockedMemSize = "TRUE"
mainMem.partialLazySave = "FALSE"
mainMem.partialLazyRestore = "FALSE"
priority.grabbed = "high"
priority.ungrabbed = "normal"
@kkkkke
kkkkke / Queue_LinkedList.c
Created November 16, 2017 20:39 — forked from mycodeschool/Queue_LinkedList.c
Linked List implementation of Queue.
/*Queue - Linked List implementation*/
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
};
// Two glboal variables to store address of front and rear nodes.
struct Node* front = NULL;
struct Node* rear = NULL;
@kkkkke
kkkkke / gist:3e6730f43a20cca1cb2f6e46f2ae7a06
Created November 16, 2017 21:02 — forked from tomwwright/gist:f88e2ddb344cf99f299935e1312da880
Dell XPS 15 9560: Ubuntu 17.10 + Nvidia 384.90 + Nvidia Prime (No Bumblebee)
# perform a fresh install of Ubuntu 17.10
# upgrade the kernel to v4.13.10
mkdir ~/kernel-v4.13.10
cd ~/kernel-v4.13.10
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-headers-4.13.10-041310_4.13.10-041310.201710270531_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-headers-4.13.10-041310-generic_4.13.10-041310.201710270531_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-image-4.13.10-041310-generic_4.13.10-041310.201710270531_amd64.deb
sudo dpkg -i *.deb
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@kkkkke
kkkkke / windows-tips.bat
Created December 6, 2020 16:30
Useful windows command line code snippet
# Restart conputer
shutdown –t 0 –f –r
# Shutdown conputer
shutdown –t 0 –f –s
# https://apple.stackexchange.com/questions/51036/what-is-the-difference-between-bash-profile-and-bashrc
# .bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

Usefule docker tips

Clean

dangling image

docker system prune --volumes --all
# Make sure git uses rebase instead of merge by default
git config --global branch.autosetuprebase always