Skip to content

Instantly share code, notes, and snippets.

View mrdaemon's full-sized avatar

Alexandre Gauthier mrdaemon

View GitHub Profile
@mrdaemon
mrdaemon / .bashrc
Created November 22, 2012 03:02
Tmux configuration
# whatever [...]
[[ -f ~/.tmux-bootstrap.sh ]] && source ~/.tmux-bootstrap.sh
[tech3@box ~]$ sudo systemctl status nginx.service
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: active (running) since Fri, 26 Oct 2012 15:43:28 -0400; 2s ago
Process: 3114 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
Process: 3121 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 3118 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 3122 (nginx)
CGroup: name=systemd:/system/nginx.service
├ 3122 nginx: master process /usr/sbin/nginx
/* trim: remove trailing blanks, tabs, newlines */
int trim(char s[])
{
int n;
for (n = strlen(s)-1; n >= 0; n--)
if (s[n] != ' ' && s[n] != '\t' && s[n] != '\n')
break;
s[n+1] = '\0';
return n;
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
In [1]: from local.api import MicrosoftTranslator
In [2]: azurekey="AzUr3k4yGoesTH3reLOLandStuFF="
In [3]: translator = MicrosoftTranslator(azurekey)
In [4]: translator.languages
Out[4]: ['ar', 'bg', 'ca', 'zh-CHS', 'zh-CHT', 'cs', 'da', 'nl', 'en', 'et', 'fi', 'fr', 'de', 'el', ht', 'he', 'hi', 'mww', 'hu', 'id', 'it', 'ja', 'ko', 'lv', 'lt', 'no', 'pl', 'pt', 'ro', 'ru', 'sk', sl', 'es', 'sv', 'th', 'tr', 'uk', 'vi']
In [5]: translator.translate(source="fr", target="en", text="Bonjour, je suis un Dee")
Out[5]: 'Hello, I am a Dee'
@mrdaemon
mrdaemon / hello.vala
Created March 28, 2012 17:03
lol vala
public class HelloWorld : Object {
public string name { get ; set; default = "World"; }
public HelloWorld() {
/* Huh. With properties accessed like fields,
and able to have default values, turns out I don't
actually have to do this. At all. Sweet shorthand,
Vala. Your syntactic sugar is growing on me. */
//this.with_name("World");
}
# Dee's tmux configuration file
# start window indexing at one instead of zero
set -g base-index 1
# Bell in any window results in term bell
set -g bell-action any
# Home as default path
set -g default-path ~/
#!/usr/bin/env bash
PROJECTS=$(pwd)/_VisualStudio2005/Projects
WEBROOTS=$(pwd)/_VisualStudio2005/WebSites
function die {
echo $1 ; exit 1
}
[[ -z $1 ]] && die "usage: import.sh [svn url]"
grep -i -e "could not" -e "cannot" sfclog.txt | awk -F ';' '{ print $1; }' | awk -F "??" '{ print $3; }' | sed -e 's/^\\//' -e 's/"\\\[.*\]"/\\/g' -e 's/"$//' | sort | uniq | tee -a ./win7sysfiles/FILELIST.TXT | sed -e '/^$/d' -e 's/\\/\//g' -e 's/^C:\(.*\)$/\/media\/wsystem\1/' -e 's/\([ ()]\)/\\\1/g' | while read i ; do if [ -f "$i" ] ; then STATUS="ERROR" ; cp "$i" ./win7sysfiles/ && STATUS="COPIED" ; else STATUS="MISSING" ; fi ; printf "%-30s%-30s\n" "`basename \"$i\"`" "[$STATUS]" ; done && echo -n "Creating checkums..." ; for f in ./win7sysfiles/* ; do md5sum $f > $f.md5sum ; done ; echo "done."
>>> import yaml
>>> stream = file('general_skills.yaml', 'r')
>>> skills = yaml.load_all(stream)
>>> skills
<generator object load_all at 0x02B29698>
>>> for skill in skills:
print skill
# So you end up with one dict per skill, which can be accessed using dict['key'] to get the values.
#!/usr/bin/env python
#
# Shittiest script to scrape http://irssi.org/themes and fetch the theme
# image screenshots, because frankly, that shit is unviewable.
from os import path, mkdir
import re
import sys
import urllib2
from urlparse import urlsplit, urljoin