Skip to content

Instantly share code, notes, and snippets.

View wrfly's full-sized avatar
💻
enjoy coding

Shaun wrfly

💻
enjoy coding
View GitHub Profile
@wrfly
wrfly / imfix.c
Created June 5, 2015 12:26
sublime_text Chinese im
/*
sublime-imfix.c
Use LD_PRELOAD to interpose some function to fix sublime input method support for linux.
By Cjacker Huang <jianzhong.huang at i-soft.com.cn>
gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
LD_PRELOAD=./libsublime-imfix.so sublime_text
*/
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
@wrfly
wrfly / auto_imfix.sh
Last active August 29, 2015 14:22
auto fix Chinese input method script
#!/bin/bash
cd /opt/sublime_text &&\
sudo wget "https://gist.githubusercontent.com/wrfly/baf1314ae25f41fe8cde/raw/45c669808bed8eb6d98fe6caa3f730076e5aede3/imfix.c"
sudo apt-get install build-essential libgtk2.0-dev
sudo gcc -shared -o imfix.so imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
sudo sed -i "s/exec/LD_PRELOAD=\/opt\/sublime_text\/imfix.so/" /usr/bin/subl
sudo sed -i "s/\/opt\/sublime_test\/sublime_text/subl/g" /usr/share/applications/sublime_text.desktop
echo "Succeed!"
exit 0;
@wrfly
wrfly / bash & nc chat
Last active August 24, 2023 17:35
A simple chat script
#!/bin/bash
# A little chat progream via ncat
# Author:wrfly Date:2015.7
# Usage:
# Server: ncat -e chat.sh -lk &
# Client: ncat server_ip
#config
db_users=user_lists
db_rooms=db_rooms
@wrfly
wrfly / kali-install-mt7601.sh
Created August 27, 2015 13:11
a bash script for kali_2 to support MT7601 ( XiaoDu WIFI; 360 WIFI; and more.)
#!/bin/bash
# By-WrFly
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "
deb-src http://http.kali.org/kali sana main non-free contrib
deb-src http://security.kali.org/kali-security sana/updates main contrib non-free
deb http://http.kali.org/kali sana main non-free contrib
deb http://security.kali.org/kali-security sana/updates main contrib non-free
" > /etc/apt/sources.list
@wrfly
wrfly / kali-install-mt7601.sh
Last active December 27, 2015 14:56
a bash script for kali_2 to support MT7601 ( XiaoDu WIFI; 360 WIFI; and more.)
#!/bin/bash
# By-WrFly
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "
deb-src http://http.kali.org/kali sana main non-free contrib
deb-src http://security.kali.org/kali-security sana/updates main contrib non-free
deb http://http.kali.org/kali sana main non-free contrib
deb http://security.kali.org/kali-security sana/updates main contrib non-free
" > /etc/apt/sources.list
@wrfly
wrfly / lcx.c
Last active December 9, 2015 11:41
linux lcx version
#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
@wrfly
wrfly / zhihu_followers.py
Created January 26, 2017 07:31
获取知乎上 你关注的人,关注你的人,和,你关注他但他却没关注你的人
#!/usr/bin/python
# -*- coding:utf-8 -*-
# A script to get zhihu followers and followees.
import urllib2
import json
HEADERS = dict()
HEADERS["Pragma"] = "no-cache"
@wrfly
wrfly / ssh-faker.go
Created January 13, 2018 15:01
A fake ssh server to record passwords.
package main
import (
"log"
"github.com/gliderlabs/ssh"
)
func main() {
log.Println("starting ssh server on port 2222...")
@wrfly
wrfly / token-bucket-test.go
Last active January 13, 2018 18:07
token-bucket-test.go
package main
import (
"context"
"log"
"time"
"github.com/bsm/ratelimit"
"github.com/tsenart/tb"
// jujuRatelimit "github.com/juju/ratelimit"