Skip to content

Instantly share code, notes, and snippets.

View toc21c's full-sized avatar
🏠
Working from home

0x323143 toc21c

🏠
Working from home
View GitHub Profile
#!/bin/bash
while read line
do
filename=$line
# line 1~23
sed -i '1,23d' $filename
done < $1
@toc21c
toc21c / diff.py
Created May 6, 2015 02:08
meld diff wrapper
#!/usr/bin/python
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
@toc21c
toc21c / diff.py
Created April 9, 2015 01:46
Meld diff script
#!/usr/bin/python
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
function ssh () {
/usr/bin/ssh -t "$@" "tmux attach || tmux new";
}
@toc21c
toc21c / eclipse-luna.desktop
Created March 3, 2015 09:13
/usr/share/applications/eclipse-luna.desktop
[Desktop Entry]
Encoding=UTF-8
Exec=/opt/eclipse-luna/eclipse/eclipse
Icon=/opt/eclipse-luna/eclipse/icon.xpm
Type=Application
Terminal=false
Comment=Eclipse Integrated Development Environment
Name=Eclipse Luna
GenericName=eclipse-4.4 M4
StartupNotify=false
@toc21c
toc21c / redis.service
Created January 21, 2015 14:32
/lib/systemd/system/redis.service
[Unit]
Description=Redis Server
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/redis-server
ExecStop=/usr/bin/kill -15 $MAINPID
PIDFile=/var/run/redis_6379.pid
Restart=always
#!/bin/sh
# what current session name
cur_sess=`gsettings get org.gnome.desktop.session session-name`
if [ "$cur_sess" = "'gnome-fallback'" ];then
echo "Changing session : 'gnome'"
dbus-launch gsettings set org.gnome.desktop.session session-name 'gnome'
echo "Changed session : 'gnome'"
@toc21c
toc21c / PRIu32.c
Last active August 29, 2015 14:00
#include <stdio.h>
#include <inttypes.h>
#include <locale.h>
int main(void)
{
setlocale(LC_NUMERIC, "");
uint32_t i = 5040;
printf("%'"PRIu32" the thousands separator\n", i);
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
struct s {
int i;
char c;
#!/usr/bin/perl
# Simple perl script to list files with a given CVS tag
# Created 2002/09/10 ec
# $Id: lstag,v 1.1 2002/09/26 10:02:53 ec Exp $
use strict;
$::VERSION = "1.0";
$::cvs_ID = '$Id: lstag,v 1.1 2002/09/26 10:02:53 ec Exp $'; #'