View gist:2870863
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$1" != "" ]]; then | |
pdf_file="$1" | |
shift | |
rm /tmp/pdf_file.txt >> /dev/null 2>&1 | |
if [[ ! -f $(which pdftotext) ]]; then | |
echo "You do not have xpdf installed, please install it to convert pdfs to text..." | |
exit 1 |
View ports.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ports () { | |
local items="$(sudo lsof -n -i -P | tr -s " " | cut -d " " -f 2,9,10 | \grep "LISTEN")" | |
printf "%-10s %-20s %s\n" "PID" "ADDRESS" "COMMAND" | |
if [[ "${items}" == "" ]] | |
then | |
return | |
fi | |
while read item | |
do | |
pid="$(echo "${item}" | awk '{print $1}')" |
View cond_var.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
var tasks []int | |
var wg sync.WaitGroup |
View gist:2002893
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Gemfile | |
gem "redis" | |
gem "redis-rails", "~> 3.2.1.rc" | |
### app/controllers/sessions_controller.rb | |
def create | |
user = User.where(email: params[:email]).first | |
# 'authenticate' comes from the 'has_secure_password' method in the User model | |
if user && user.authenticate(params[:password]) | |
session[:user_id] = user.id # Set a session from the id |
View gist:8305641
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias update="sudo apt-get update" | |
alias upgrade="update && sudo apt-get upgrade" | |
alias dist-upgrade="upgrade && sudo apt-get dist-upgrade" | |
alias install="sudo apt-get install ${@:2}" | |
alias uninstall="sudo apt-get purge ${@:2}" | |
alias search="apt-cache search ${@:2}" |
View gist:7997198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Write contents from stdin to a given file | |
section .rodata | |
errnofile: db "No filename given", 10 | |
errnofilelen: equ $ - errnofile | |
errnocreate: db "Couldn't create file", 10 | |
errnocreatelen: equ $ - errnocreate | |
errnowrite: db "Couldn't write file", 10 | |
errnowritelen: equ $ - errnowrite | |
section .bss |
View gist:7904573
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
static char *strs[] = {"example", "another", "hi"}; | |
static int strc = 3; | |
int main(void) { | |
int i = 0; | |
int size = 1; |
View gist:7653454
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
extern main | |
section .text | |
_start: | |
call main | |
mov ebx, eax ; EAX HOLDS THE FUCKING RETURN STATUS, OMG | |
mov eax, 1 | |
int 0x80 |
View gist:7629514
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Layout of pins: | |
3 10 | |
4 7 11 | |
1 5 8 12 | |
2 6 9 13 | |
*/ | |
#include <EEPROM.h> | |
int startupDone = 0; |
View gist:6941140
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"flag" | |
"fmt" | |
"net/http" | |
"net/url" | |
"os" |
NewerOlder