Skip to content

Instantly share code, notes, and snippets.

View josue's full-sized avatar
:shipit:
Crushing it from 1999 to Present

Josué Rodriguez josue

:shipit:
Crushing it from 1999 to Present
View GitHub Profile
@Tonkpils
Tonkpils / goroutines.go
Created June 11, 2015 00:33
Simple Goroutines examples
package main
import (
"fmt"
"time"
)
func longFunction(name string, dur time.Duration) {
fmt.Printf("Started %s: lasting %s\n", name, dur)
time.Sleep(dur)
require 'redis'
require 'msgpack'
class ObjectDB
def initialize(*redis_args)
@connection = Redis.connect(*redis_args)
end
def get(key)
@lelandbatey
lelandbatey / gifConvert.sh
Last active February 5, 2016 09:29
Convert video to .gif really easily. See this commit to my help files as an example: https://github.com/lelandbatey/configDebDev/blob/master/helpFiles.txt#L113
#!/bin/bash
#Alright, so this should automatically convert a given video into a gif called optimized_output.gif
# See here for explanation: https://github.com/lelandbatey/configDebDev/blob/master/helpFiles.txt#L113
ffmpeg -i $1 out%04d.gif # Extracts each frame of the video as a single gif
convert -delay 4 out*.gif anim.gif # Combines all the frames into one very nicely animated gif.
convert -layers Optimize anim.gif optimized_output.gif # Optimizes the gif using imagemagick
# vvvvv Cleans up the leftovers
@noonien
noonien / async_loader.js
Created July 16, 2012 17:36
Asynchronous Javascript/CSS loader.
AL = function(type, url, callback) {
var el, doc = document;
switch(type) {
case 'js':
el = doc.createElement('script');
el.src = url;
break;
case 'css':
el = doc.createElement('link');
@mm53bar
mm53bar / deploy.rb
Created October 7, 2011 21:05
My capistrano deployment
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
@jed
jed / LICENSE.txt
Created May 10, 2011 16:04 — forked from 140bytes/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ekanna
ekanna / map2json.go
Created July 17, 2013 17:02
Generating arbitrary JSON data using map in golang
// Generating arbitrary JSON data using map
package main
import "fmt"
import "encoding/json"
func main() {
keys := []string{"Segment", "Jan", "Feb", "Apr"}
values := []interface{}{"ME",1000,2000,3000}
@cannium
cannium / aes-256-gcm.go
Last active May 9, 2021 20:19
golang aes-256-gcm
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)
@msharp
msharp / aws-lambda-unzipper.py
Created February 6, 2017 22:52
unzip archive from S3 on AWS Lambda
import os
import sys
import re
import boto3
import zipfile
def parse_s3_uri(url):
match = re.search('^s3://([^/]+)/(.+)', url)
if match:
return match.group(1), match.group(2)
@hydra35
hydra35 / batch-strace.sh
Created February 23, 2012 14:31
strace all the php-fpm worker processes
#!/bin/bash
additional_strace_args="$1"
MASTER_PID=$(ps auwx | grep php-fpm | grep -v grep | grep 'master process' | cut -d ' ' -f 6)
while read -r pid;
do
if [[ $pid != $MASTER_PID ]]; then
nohup strace -r -p "$pid" $additional_strace_args >"$pid.trc" 2>&1 &