Skip to content

Instantly share code, notes, and snippets.

@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@Buildstarted
Buildstarted / paste.html
Last active June 20, 2016 03:30
Used to capture the clipboard in both mozilla and webkit browsers
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<!-- normally you wouldn't show this -->
<div id="paste" contenteditable="true"></div>
<script type="text/javascript">
@back2dos
back2dos / Main.hx
Created January 22, 2013 15:25
Metadata checking
package ;
@:build(MetaCheck.build())
class Main {
static function main() {
trace(Meta.getStatics(Main).main.AngularSupport);
}
@AngularSupport({ inject:["$scope", '$http'], scope:'$scope' })
function foo() {}
@AngularSupport({ inject:["$scope", '$http'], scfope:'$scope' })//will cause an error
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@gre
gre / deploy.sh
Last active October 8, 2021 00:33
Super-small scripts for easy PlayFramework deployment
#!/bin/bash
REMOTE=play@SERVER_IP
REMOTE_APP=/home/play/PROJECT_NAME/
sbt stage || exit 1;
rsync -va target/ $REMOTE:$REMOTE_APP/target;
ssh $REMOTE "cd $REMOTE_APP; ./stop.sh";
ssh $REMOTE "cd $REMOTE_APP; ./start.sh";
@itang
itang / sbtnew
Last active December 20, 2015 00:49
sbtnew => sbt new project shell
#!/bin/bash
#-----------------------------------------------------------------------------
# Modified By itang
#-----------------------------------------------------------------------------
## Origin info
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Purpose: Create an SBT project directory structure with a few simple options.
@SamuelMarks
SamuelMarks / egghead_YouTube_downloader.py
Last active November 3, 2018 09:32
Simple algorithm to download all the egghead.io videos in highest-quality from YouTube.
"""
Simple algorithm to download all the egghead.io videos in highest-quality from YouTube.
Run from the directory you want the videos to appear. Renames them so that they have the video number + omit the repetitive "Egghead.io - AngularJS -" text.
Installing dependency:
$ pip install git+https://github.com/NFicano/pytube#egg=pytube
"""
from pytube import YouTube #, exceptions as YTD_exceptions
@mestizo
mestizo / gist:9167834
Last active February 27, 2023 22:39
Completely disable IPv6 on OSX
#To Get List of Hardware
sudo networksetup -listallhardwareports
#To Disable IPv6 on Wifi Adapter
sudo networksetup -setv6off wi-fi
#To Disable IPv6 on Built-in Ethernet Adapter
sudo networksetup -setv6off Ethernet
@spoike
spoike / reflux.js
Created June 29, 2014 22:23
A simpler implementation of React.JS's Flux
var EventEmitter = require('events').EventEmitter,
_ = require('lodash');
/**
* Creates an action functor object
*/
exports.createAction = function() {
var action = new EventEmitter(),
eventLabel = "action",
@jcouyang
jcouyang / vpn
Last active August 29, 2015 14:03
connect cisco anyconnect in terminal
#!/bin/sh
/opt/cisco/anyconnect/bin/vpn -s $1 blur.blur.com <<"EOF"
0
your.name
your.password
y
exit
EOF