Skip to content

Instantly share code, notes, and snippets.

@TheAnonymous
TheAnonymous / C++ SQLite read
Created November 2, 2010 13:13
How to read a SQLite Database
#include <sqlite3.h>
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int zeile;
@TheAnonymous
TheAnonymous / Int2Char
Created November 2, 2010 13:17
Make a int to a const char array pointer
int operator1 = 12;
const gchar * operator1_char = g_strdup_printf("%d", operator1);
//Only tested with compileroption -std=gnu++0x
git clone git://github.com/mumble-voip/mumble.git mumble
cd mumble
git submodule init
git submodule update
git checkout --track -b master origin/master
qmake CONFIG+=no-server CONFIG+=nog15 CONFIG+=no-bundled-celt CONFIG+=no-upate CONFIG+=static main.pro -recursive
make -j50 //Falls es Fehler gibt nochmal mit "make -j1" posten damit Fehler in richtiger Reihenfolge sind
@TheAnonymous
TheAnonymous / set_brightness.sh
Created March 14, 2013 10:38
This script is for Lenovo T400s (may work on others too...) to set the brightness through the console. Tested on Fedora 18. To get the path for your Laptop this command may helps you find /sys -iname *bright*
#!/bin/bash
ab=`cat /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/actual_brightness`
mb=`cat /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/max_brightness`
echo "The max brightness is " $mb " your actual brightness is " $ab " please enter your new brightess:"
read cb
echo $cb > "/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness"
@TheAnonymous
TheAnonymous / Bcache Tutorial
Last active April 21, 2019 03:46
Making a SSD working as a Cache for a HDD with bcache.
There are 3 Methods for using a SSD as cache.
dm-cache, bcache,enhance-io all three should be avaliable in Kernel Version 3.10.
Performance differenceses are discussed here => http://lkml.indiana.edu/hypermail/linux/kernel/1306.1/01246.html
In this tutorial I will use bcache since dm-cache didn't worked for me.
At the moment there is only an rc5 candidate for kernel 3.10.0
How to compile it is explained below. If you have a newer kernel than 3.10 and it is bcache enabled you dont need to compile it by yourself. In this case just jump over the kernel-compile-exlanation. If your kernel is compiled with bcache support you can test with "modprobe bcache". If that doesnt throw an error it should work :)
I will link to the tutorials I used. If you found better ones please paste a link in the comments
How to compile a kernel by yourself is explained at:
=> http://bodhizazen.net/Tutorials/kernel
@TheAnonymous
TheAnonymous / delete_unused_latex.sh
Last active December 23, 2015 19:29
This script searches& deletes files that nobody needs execpt LaTex itself. So whe you normally makea PDF with LaTex you have n files laying around which you done need this makes it hard to see the files which are important. This Script searches and deltes them. Watches if md5sum of pdf changed and if yes then deletes files which where prodouced …
#!/bin/bash
while [ 1 ]
do
hash2=$(md5sum `find -iname "*.pdf"`|awk '{print $1}')
sleep 2
hash=$(md5sum `find -iname "*.pdf"`|awk '{print $1}')
if [ $hash2 != $hash ]
then
echo "Delted some unused files"
rm `find -iname "*.aux" -o -iname "*.out" -o -iname "*.fls" -o -iname "*.bbl" -o -iname "*.blg" -o -iname "*.fdb_latexmk" -o -iname "*.lof" -o -iname "*.lot" -o -iname "*.toc"`
@TheAnonymous
TheAnonymous / gist:7099525
Created October 22, 2013 12:13
Example of how to escape illegal character in ruby UTF-8
result = result.encode("UTF-8", "binary", :invalid => :replace, :undef => :replace, :replace => "")

#Singe Command

  • script = record and replay a terminal session
  • tig = git gui
  • yum-builddep programname
  • akmod
  • localmodconfig
  • toast arm paketname
  • /dev/urandom
  • bc = calculator
"breaking bad"
"Martin, author of the A Song of Ice and Fire novels, particularly the episode \"Ozymandias\" and commenting that \"Walter White is a bigger monster than anyone in Westeros.\"[134] In his review of the second half of season 5, Seth Amitin of IGN stated, \"This final batch of Breaking Bad is one of the best run of episodes TV has ever offered.\"[135] Awards and nominations[edit] The series has won numerous awards and nominations, including ten Primetime Emmy Awards with one for Outstanding Drama Series"
"house of cards"
"Three of its web series, Arrested Development, Hemlock Grove and House of Cards, earned a combined 14 nominations.[31] Among House of Cards' nine nominations, \"Chapter 1\" received four nominations for the 65th Primetime Emmy Awards and 65th Primetime Creative Arts Emmy Awards becoming the first webisode (online-only episode) of a television series to receive a major Primetime Emmy Award nomination: Outstanding Directing for a Drama Series for David Fincher"
@TheAnonymous
TheAnonymous / find_dates.rb
Created November 7, 2013 12:10
example Method to find a date in a text
def find_dates text
twd = Array.new #twd = text with date
twd.concat text.scan(/[^\d](\d{1,2}[^\w\d ]\d{1,2}[^\w\d ]\d{4})/i) #26.03.1988
twd.concat text.scan(/[^\d](\d{1,2}[^\w\d ]\d{1,2}[^\w\d ]\d{2})/i) #26.03.88
twd.concat text.scan(/[^\d](\d{4}[^\w\d ]\d{1,2}[^\w\d ]\d{1,2})/i) #1988.03.26
twd.concat text.scan(/[^\d](\d{2}[^\w\d ]\d{1,2}[^\w\d ]\d{1,2})/i) #88.03.26
twd.concat text.scan(/(\d{1,2}.?(January|Januar|February|Februar|March|März|April|May|Mai|June|Juni|July|Juli|August|September|October|Oktober|November|December|Dezember)[^\w\d]\d{4})/i)
twd.concat text.scan(/(\d{1,2}.?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^\w\d]\d{4})/i)
end