Skip to content

Instantly share code, notes, and snippets.

View dhilst's full-sized avatar
😻

Daniel Hilst dhilst

😻
View GitHub Profile
@dhilst
dhilst / gist:9029a8e9f85a96243440e570a55355ec
Last active April 30, 2018 22:40
Creating vms in xCAT
rmvm vm1 -p
rmdef vm1
mkdef vm1 groups=vm,all \
ip=192.168.122.2 \
mgt=kvm \
vmcpus=2 \
vmhost=kvmhost \
vmmemory=2048 \
vmnics=virbr0 \
vmnicnicmodel=rtl8139 \
https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/changing-the-default-boot-entry
@dhilst
dhilst / max.py
Created June 23, 2018 15:51
py-recursive-iterator-max.py
def max_(iterator):
try:
n = next(iterator)
except TypeError:
return max_(iter(iterator))
except StopIteration:
return
else:
rest = max_(iterator)
return n if rest is None or n > rest else rest
@dhilst
dhilst / bash-fc.beJW0k
Created June 30, 2018 13:46
google-oauth-example-with-httpie.sh
http GET https://accounts.google.com/o/oauth2/v2/auth redirect_uri==http://localhost:8000/accounts/google/login/callback/ response_type==code client_id==419312690453-o4grg1t8isrjbljfnnno7c7jj520fpao.apps.googleusercontent.com scope==https://www.googleapis.com/auth/calendar.readonly access_type==offline prompt==consent -v
@dhilst
dhilst / compose.py
Created July 18, 2018 16:27
compose-class.py
from functools import reduce
def compose(f, g):
def composed(*args, **kwargs):
return f(g(*args, **kwargs))
return lambda *args, **kwargs: f(g(*args, **kwargs))
class Compose:
@dhilst
dhilst / interrupts.py
Created August 13, 2018 21:19
sort /proc/interrupts Py27
import re
with open('/proc/interrupts') as f:
lines = f.readlines()[1:]
interrupts = {}
for line in lines:
interrupt, counters = line.split(':', 1)
interrupts[interrupt] = sum(int(c) for c in counters.split() if re.match(r'^\s*\d+\s*$', c) is not None)
for i, c in sorted(interrupts.iteritems(), key=lambda pair: pair[1], reverse=True):
@dhilst
dhilst / pygrub2-reboot.py
Last active August 14, 2018 17:02
select next grub boot
#!/usr/bin/python
import sys
import os.path
import re
from subprocess import check_call
def main(path):
entries = []
with open(path, 'r') as f:
for line in f.readlines():
@dhilst
dhilst / .vimrc
Last active September 16, 2018 00:13
vimrc
" vim use the first python interpreter that is
" loaded. This force it to load python3 :-)
" py3 pass
" fish shell is not posix. This leads to errors
" while VundleInstall. This fix it
set shell=bash
syntax on
set background=dark
@dhilst
dhilst / .vimrc
Created September 16, 2018 00:13
vimrc
" vim use the first python interpreter that is
" loaded. This force it to load python3 :-)
" py3 pass
" fish shell is not posix. This leads to errors
" while VundleInstall. This fix it
set shell=bash
syntax on
set background=dark
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I/opt/qt/5.5/clang_64/lib/QtCore.framework/Headers -I. -I/opt/qt/5.5/clang_64/mkspecs/macx-clang -F/opt/qt/5.5/clang_64/lib -o qtdetail.o qtdetail.cpp
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from qtdetail.cpp:1:
In file included from /opt/qt/5.5/clang_64/lib/QtCore.framework/Headers/QCoreApplication:1:
In file included from /opt/qt/5.5/clang_64/lib/QtCore.framework/Headers/qcoreapplication.h:37:
/opt/qt/5.5/clang_64/lib/QtCore.framework/Headers/qglobal.h:39:12: fatal error: 'cstddef' file not found
# include <cstddef>
^~~~~~~~~
1 warning and 1 error generated.