Skip to content

Instantly share code, notes, and snippets.

View lukas2511's full-sized avatar
🔓
Your connection to this site is not secured.

Lukas Schauer lukas2511

🔓
Your connection to this site is not secured.
View GitHub Profile
@lukas2511
lukas2511 / toggle_speaker_headphone.sh
Created April 2, 2013 09:43
ich präsentiere ihnen: frickel. lenovo l430 series 3 dock audio foo. dislike.
current=$(pactl list | grep Active\ Port\:\ analog\-output | awk '{print $3}')
headphone=$(pactl list | grep analog-output-headphones | grep available | head -n1 | awk '{print $5}' | cut -d')' -f1)
if [ "$current" = "analog-output-headphones" ]
then
pactl set-sink-port 0 analog-output-speaker
sudo hda-verb /dev/snd/hwC0D0 0x01b SET_PIN_WIDGET_CONTROL 0x00
if [ "$headphone" = "not" ]
then
sudo hda-verb /dev/snd/hwC0D0 0x014 SET_PIN_WIDGET_CONTROL 0x40
@lukas2511
lukas2511 / i3status.py
Created June 15, 2013 17:45
Just a simple script to be used with i3bar
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from mpd import (MPDClient, CommandError)
import sys
import os
import pytz
import socket
import fcntl
import struct
@lukas2511
lukas2511 / gist:5922009
Created July 3, 2013 19:35
froxlor makeCryptPassword wrapper
<?php
function generatePassword()
{
global $db, $settings;
return substr(md5(uniqid(microtime(), 1)), 24, 10);
}
function makeCryptPassword ($password, $type = 0)
@lukas2511
lukas2511 / .Xdefaults
Created July 26, 2013 12:31
zsh urxvt pos1, end, etc.
URxvt*keysym.Home: \033[1~
URxvt*keysym.End: \033[4~
@lukas2511
lukas2511 / stm32flash.md
Created March 14, 2014 01:56
STM32F4-Discovery über UART flashen

Hardware

  • STM32F4-Discovery TX: PB10 (-> FTDI RX)
  • STM32F4-Discovery RX: PB11 (-> FTDI TX)
  • STM32F4-Discovery BOOT1/PB2: 0V
  • STM32F4-Discovery BOOT0: 3-5V

Alle beteiligten Pins scheinen 5V-tolerant zu sein, lieber aber vorher nochmal im Datenblatt nachgucken.

Software

### Keybase proof
I hereby claim:
* I am lukas2511 on github.
* I am lukas2511 (https://keybase.io/lukas2511) on keybase.
* I have a public key whose fingerprint is 3C2F 2605 E078 A1E1 8F47 9390 9C4D BE6C F438 F333
To claim this, I am signing this object:
@lukas2511
lukas2511 / ParcelApp.py
Last active June 8, 2018 20:19
ParcelApp.py
#!/usr/bin/python2
import re
import datetime
import urllib
import urllib2
import cookielib
import os
import json
import curses
@lukas2511
lukas2511 / 3dsload.py
Created November 23, 2014 20:37
push file to 3ds
#!/usr/bin/env python
import socket
import sys
import time
TCP_IP = '192.168.100.241'
TCP_PORT = 9000
MESSAGE = open(sys.argv[1], "rb").read();
@lukas2511
lukas2511 / stuff.c
Created November 24, 2014 16:10
3ds: list files in directory
Handle dirHandle;
FS_path dirPath=FS_makePath(PATH_CHAR, "/");
FSUSER_OpenDirectory(NULL, &dirHandle, sdmcArchive, dirPath);
u32 entriesRead=0;
do {
u16 entryBuffer[512];
char data[256];
FSDIR_Read(dirHandle, &entriesRead, 1, (FS_dirent*)entryBuffer);
if(!entriesRead){
print("END");
@lukas2511
lukas2511 / daemon.conf
Created February 7, 2015 03:40
my pulseaudio config
[...]
default-sample-format = s32le
default-sample-rate = 48000
default-sample-channels = 6
enable-remixing = yes
enable-lfe-remixing = yes
flat-volumes = no