Skip to content

Instantly share code, notes, and snippets.

View fpersson's full-sized avatar

Fredrik Persson fpersson

View GitHub Profile
@fpersson
fpersson / getgist.py
Created October 1, 2014 21:13
How to list my public gist
import pycurl
import json
from StringIO import StringIO
from pprint import pprint
buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, 'https://api.github.com/users/fpersson/gists')
c.setopt(c.WRITEFUNCTION, buffer.write)
c.perform()
@fpersson
fpersson / gitstat.sh
Created February 19, 2015 11:35
Find large files in git repo
#!/bin/bash
TMPFILE="/tmp/gitstat.txt"
FILENAME="/tmp/gitstat_files.txt"
if [ -d $1 ] ; then
if [ -f $2 ] ; then
rm $2
fi
@fpersson
fpersson / create.sh
Created May 20, 2015 19:57
A hard way to write Hello World i Bash or a easy way to create a c++ project
#!/bin/bash
############################################
# Name: create.sh
# Usage: ./create.sh app-name
############################################
PROJECTNAME=$1
WORKINGDIR=$HOME/development/$PROJECTNAME
SRCDIR=$WORKINGDIR/src
@fpersson
fpersson / android-log.xml
Created June 16, 2015 13:25
Syntaxhighligting for android logfile, save the xml to ~/.kde/share/apps/katepart/syntax/android-log.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
This file is part of KDE's kate project.
copyright : (C) 2015 by Fredrik Persson
email : [email protected]
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@fpersson
fpersson / 51-android.rules
Created November 27, 2015 09:33
/etc/udev/rules.d/
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0x15a2", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"
#Acer
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0660", GROUP="plugdev"
##ASUS
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0660", GROUP="plugdev"
@fpersson
fpersson / daemon.py
Created July 22, 2016 14:13
Python daemon example
#!/usr/bin/env python
# coding: utf-8
import argparse
import os
import sys
import time
import atexit
import logging
import signal
#!/bin/bash
#put in $HOME/bin/
OIFS=$IFS
NOW=$(date +"%y%m%d")
IFS='.' read -r -a array <<< $1
for result in "${array[@]}"; do
echo $result
done
@fpersson
fpersson / unix_color.cpp
Last active November 23, 2022 11:12
Unix color for c++
#ifndef UNIX_COLOR_H
#define UNIX_COLOR_H
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@fpersson
fpersson / CMakeLists.txt
Last active January 2, 2017 13:47
Minimal sytemd app
cmake_minimum_required(VERSION 3.6)
project(testd)
set(CMAKE_CXX_STANDARD 11)
find_package(PkgConfig)
pkg_check_modules(SYSTEMD libsystemd REQUIRED)
IF(NOT SYSTEMD_FOUND)
message(FATAL_ERROR "ERROR: Systemd not found")
@fpersson
fpersson / download_eso.sh
Created April 12, 2017 14:02
ladda ner spel till windows från linux
#!/bin/bash
USERNAME=""
APPID="306130" #ESO
DEST=""
steamcmd +@sSteamCmdForcePlatformType windows +login $USERNAME +force_install_dir $DEST +app_update $APPID validate +quit