Skip to content

Instantly share code, notes, and snippets.

View fuzzmz's full-sized avatar

Serban Constantin fuzzmz

View GitHub Profile
@fuzzmz
fuzzmz / h1e9.py
Created February 24, 2012 01:12
Udacity CS101 Homework 1 Ex 9
#Given a variable, x, that stores
#the value of any decimal number,
#write Python code that prints out
#the nearest whole number to x.
#You can assume x is not negative.
# x = 3.14159 -> 3 (not 3.0)
# x = 27.63 -> 28 (not 28.0)
@fuzzmz
fuzzmz / 2012_01_20-backups.md
Created February 26, 2012 14:35
Backups blog post markdown syntax

Date: 2012-01-20 03:38 Title: Up, up, backup! Tags: backup, ftp, archive Category: linux Slug: backups

As I was saying at the end of the last post, locking myself out of the server really made me want to have implemented my backup mechanism sooner, especially considering that at this point in the life of QWERTY (my VPS) there isn't that much to back up.

In short, my backup needs are simple:

@fuzzmz
fuzzmz / 2012_01_22-play_with_python.md
Created March 21, 2012 06:23
pelican md article example
@fuzzmz
fuzzmz / highlight.md
Created March 23, 2012 09:21
pelican/md code highlight example

This is a really simple bash script which creates a .tar.gz archive of the folders I specify. I could further improve the script by making it do incremental backups instead of creating a new archive each day, but considering that this is a fast and dirty version of it, and that I don't have that much stuff to back up, it'll do for now.

:::bash
#!/bin/sh
date
echo "############### Backing up files on the system... ###############"

backupfilename=server_file_backup_`date '+%Y-%m-%d'`

echo "----- Now tar, then zip up all files to be saved -----"

@fuzzmz
fuzzmz / pineapple.md
Created April 21, 2012 12:21
Pineapple and Hare State Exam Question

This is a question that recently got published as a NY State Exam for the eight-grade. You can find the full article here but I'm publishing the story itself, plus the questions here for easier reading (that article is a bit of a mess).


In the olden times, animals could speak English, just like you and me. There was a lovely enchanted forest that flourished with a bunch of these magical animals.

One day, a hare was relaxing by a tree. All of a sudden, he noticed a pineapple sitting near him.

The hare, being magical and all, told the pineapple, "Um, hi."

@fuzzmz
fuzzmz / extract.bat
Created June 7, 2012 21:52
Recursively extract archives in nested folders with 7-zip
FOR /D /r %%F in ("*") DO (
pushd %CD%
cd %%F
FOR %%X in (*.rar *.zip) DO (
"C:\Program Files\7-zip\7z.exe" x %%X
)
popd
)
@fuzzmz
fuzzmz / disable_vs2012_caps.ps1
Created August 17, 2012 14:05
Disable Visual Studio 2012 all-caps menus
Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
@fuzzmz
fuzzmz / tor-uk
Created November 19, 2012 12:47
Tor Strict UK Exit nodes
ExitNodes 0000000000Marauder,anonion,colinwillsdorkyahoo,gigatux,gerkin,devasdfasdf,Persepolis,ephemer2,000000000000haven,Alice
StrictNodes 1
CircuitBuildTimeout 5
NumEntryGuards 6
KeepalivePeriod 60
NewCircuitPeriod 15
@fuzzmz
fuzzmz / gist:4111521
Created November 19, 2012 16:11
git revert to specific commit
git reset 56e05fced #resets index to former commit; replace '56e05fced' with your commit code
git reset --soft HEAD@{1} #moves pointer back to previous HEAD
git commit -m "Revert to 56e05fced"
git reset --hard #updates working copy to reflect the new commit
@fuzzmz
fuzzmz / update.sh
Created November 23, 2012 09:14
Pelican auto-make and push script
#!/bin/sh
pelican -s /path/to/pelicanconf.py /path/to/content -o /path/to/$username.github.com -t /path/to/yourtheme
cd /path/to/$username.github.com
git add .
git commit -am "update blog"
git push origin master