Skip to content

Instantly share code, notes, and snippets.

View coffman21's full-sized avatar

coffman21

View GitHub Profile
@coffman21
coffman21 / sql-server-merge.sql
Last active November 29, 2018 12:09
sql server merge
create table source
(
id int not null primary key identity (1,1),
a varchar,
b varchar
);
select * from source
create table target
@coffman21
coffman21 / ifcfg-eth0
Last active January 24, 2019 09:33
ifcfg-eth0-example
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
# For static IP
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
HWADDR=XX:XX:XX:XX:XX:XX
# For DHCP
@coffman21
coffman21 / .bashrc
Created February 25, 2019 07:33
bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
@coffman21
coffman21 / .vimrc
Created February 25, 2019 07:47
vimrc
filetype plugin on
syntax on
set number
set autoindent
" bindings for copy paste and cut
vmap <C-C> "+y
vmap <C-X> "+c
vmap <C-V> c<ESC>"+p
@coffman21
coffman21 / 69-synaptic.conf
Created February 25, 2019 07:49
/org/X11/xorg.conf.d/69-synaptic.conf
Section "InputClass"
Identifier "SynPS/2 Synaptics TouchPad"
MatchProduct "SynPS/2 Synaptics TouchPad"
MatchIsTouchpad "on"
MatchOS "Linux"
MatchDevicePath "/dev/input/event*"
#Option "Ignore" "on"
EndSection
@coffman21
coffman21 / 10-monitor.conf
Created February 25, 2019 07:50
/etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
Identifier "VGA-1"
Modeline "1920x1080R" 138.50 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
Option "PreferredMode" "1920x1080R"
Option "RightOf" "eDP-1"
Option "DPMS" "true"
EndSection
Section "Monitor"
Identifier "eDP-1"
@coffman21
coffman21 / ipython-killer.sh
Created February 25, 2019 14:00
Kill ipython kernel of mem exceed 9.5 Gb
#!/bin/bash
mem=0
echo '' > '1.lg'
i=0
while true; do
mem=$(free -m | grep Mem | awk {'print $3'})
if [ $i -eq 50 ]; then
date >> '1.lg'
echo $mem >> '1.lg'
@coffman21
coffman21 / commit-msg
Created March 20, 2019 10:17
Git hook which adds branch name to commit
#!/bin/sh
BRANCH=$(git symbolic-ref --short HEAD)
COMMIT_MSG=$(cat $1)
if [[ $BRANCH == CPP-* ]] ;
then
echo "$BRANCH $COMMIT_MSG" > $1
exit 0
else
echo "$COMMIT_MSG" > $1