Skip to content

Instantly share code, notes, and snippets.

View vjo's full-sized avatar

Victor Jolissaint vjo

View GitHub Profile
@vjo
vjo / favicon.html
Last active December 22, 2015 15:29
Favicon cheat sheet snipset - from https://github.com/audreyr/favicon-cheat-sheet
<html>
<head>
<!-- For the main favicon itself, it's best for cross-browser compatibility not to use any HTML.
Just name the file favicon.ico and place it in the root of your domain. -->
<!-- Touch icon for iOS 2.0+ and Android 2.1+ -->
<link rel="apple-touch-icon-precomposed" href="path/to/favicon-152.png">
<!-- IE 10 Metro tile icon -->
<meta name="msapplication-TileColor" content="#FFFFFF"> <!-- replace #FFF -->
<meta name="msapplication-TileImage" content="/path/to/favicon-144.png">
@vjo
vjo / get_tweet_id.js
Created August 27, 2013 16:09
Make a Twitter search, past this code in a JS console and you get the tweet id of the matching tweet
// this line will copy the result in your clipboard
//copy($.makeArray($(".content").find('.time').find('a').map(function() {return $(this).attr("href");})).map(function(el) {return el.split("/")[3];}).join("\n"))
$.makeArray(
$(".content").find('.time').find('a').map(
function() { return $(this).attr("href"); }
)
).map(
function(el) { return el.split("/")[3]; }
).join("\n");
@vjo
vjo / gopro-timelapse.sh
Last active February 20, 2016 14:06
Sort my gopro timelapse photos and convert it in a movie with ffmpeg
# Create a directory where to move your renamed photos
mkdir img
# Rename your first G0....JPG photos in img/img000001.JPG and so on
x=1;for i in G0*JPG; do counter=$(printf %06d $x); ln "$i" img/img"$counter".jpg; x=$(($x+1)); done
# Rotate photos if needed
cd img
for file in *.jpg; do convert $file -rotate 180 rotated-$file; done

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1

@vjo
vjo / gist:5109135
Last active December 14, 2015 15:38
Networking - Shell Tricks
'lsof -i' monitors network connections in real time
'sudo lsof -i -P | grep -i "listen"' Check open port
'iftop' shows bandwith usage per *connection*
'nethogs' shows the bandwith usage per *process*
'python -m SimpleHTTPServer 8080' shares all the files in the current folder over HTTP, port 8080
@vjo
vjo / url_opener.py
Last active December 12, 2015 06:59
Open url with cookies
import urllib2
with open('hack_file.txt') as f:
content = f.readlines()
for id in content:
headers = {'Cookie': 'cookie1=value1; cookie2=value2; cookie3=value3;'}
url = "http://url.com/id/%s" % id
req = urllib2.Request(url, None, headers)
resp = urllib2.urlopen(req)
@vjo
vjo / gist:4381049
Created December 26, 2012 15:58 — forked from anonymous/gist:4381021
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX sim: <http://purl.org/ontology/similarity/>
PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX ov: <http://open.vocab.org/terms/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
@vjo
vjo / send_mail.py
Created November 20, 2012 16:48
[Python] Send email with embedded image and application attachment
#! /usr/bin/python
import smtplib
from optparse import OptionParser
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
@vjo
vjo / convert_date.sh
Created November 20, 2012 11:42
Convert a date in one timezone into another using GNU date
TZ=EST date -d "Tue, 13 Nov 2012 16:39:51 -0800" # Convert a date in one timezone into another using GNU date.
@vjo
vjo / mailx_site_monitor.sh
Created November 20, 2012 10:21 — forked from eykanal/mailx_site_monitor.sh
Simple tool using curl, mailx, and a crontab to monitor whether a site is up or not
#!/bin/sh
# How many seconds does it usually take your site to respond?
sec=2
# Try to download the site to a file
curl -s -m $sec example.org > /tmp/dltime
# Get size of file
a=`wc -m /tmp/dltime | awk '{print $1}'`