Skip to content

Instantly share code, notes, and snippets.

View GregPK's full-sized avatar

Grzegorz Kaczorek GregPK

View GitHub Profile
@GregPK
GregPK / tn.rb
Created August 4, 2019 12:31
tn - a taskwarrior script to show my my most important tasks
#!/usr/bin/ruby
require 'time'
filters = []
configs = []
hour = Time.now.hour
def is_weekend?
t = Time.now
t.saturday? || t.sunday?
@GregPK
GregPK / hyper.txt
Last active July 21, 2019 16:30
xef | ts (Meta vs Super keys)
Jul 21 18:23:10 KeyPress event, serial 37, synthetic NO, window 0xa000001,
Jul 21 18:23:10 root 0x1f5, subw 0x0, time 11238404, (103,-1), root:(964,456),
Jul 21 18:23:10 state 0x10, keycode 133 (keysym 0xffed, Hyper_L), same_screen YES,
Jul 21 18:23:10 XLookupString gives 0 bytes:
Jul 21 18:23:10 XmbLookupString gives 0 bytes:
Jul 21 18:23:10 XFilterEvent returns: False
Jul 21 18:23:11
Jul 21 18:23:11 KeyRelease event, serial 37, synthetic NO, window 0xa000001,
Jul 21 18:23:11 root 0x1f5, subw 0x0, time 11238752, (103,-1), root:(964,456),
Jul 21 18:23:11 state 0x50, keycode 133 (keysym 0xffed, Hyper_L), same_screen YES,
@GregPK
GregPK / past_dweller.rb
Created November 22, 2018 12:50
past_dweller
require 'date'
MONTHS = 18
CMD = 'git log --pretty="%an %ae%n%cn %ce" -- graphql_api | sort | uniq | wc -l'
# cloc . | grep Ruby
results = []
MONTHS.times do |i|
date = (DateTime.now - (i*30)).strftime("%Y-%m-%d")
`git checkout \`git rev-list -n 1 --before="#{date} 00:00" master\` > /dev/null 2>&1`
@GregPK
GregPK / FileUploadComponent.jsx
Created May 22, 2017 07:32 — forked from github0013/FileUploadComponent.jsx
how to upload files using graphql + apollo client
class FileUploadComponent extends Component{
upload(){
this.props.mutate({
variables: {
id,
avatar: this.inputFile.files[0] //this is how you send file
}
}).
then(({data}) => {
console.log(data)
@GregPK
GregPK / pulse-audio-switch.rb
Created January 16, 2017 16:17
pulse-audio-switch.rb
#!/usr/bin/env ruby
sink_output = `pacmd list-sinks`
sinks_index_lines = sink_output.each_line.select{|line| line =~ /index/}
sinks_indexes = sinks_index_lines.map{|index_line| Integer(index_line.strip.gsub(/[^\d]/,'')) }
# optional - for more descriptive notification message
card_names = sink_output.each_line.select{|line| line =~ /alsa.card_name/}.map{ |l| l.gsub(/.+ = "(.+)"/,'\1').strip }
card_names_dict = Hash[sinks_indexes.zip(card_names)]
@GregPK
GregPK / icon-maker-titanium-android
Created May 13, 2015 16:19
given an appicon.png file in the `platform/android/res` directory of the Titanium project, will generate icons with proper sizes for all devices
convert appicon.png -resize 192x192\! drawable-xxxhdpi/appicon.png && \
convert appicon.png -resize 144x144\! drawable-xxhdpi/appicon.png && \
convert appicon.png -resize 96x96\! drawable-xhdpi/appicon.png && \
convert appicon.png -resize 72x72\! drawable-hdpi/appicon.png && \
convert appicon.png -resize 48x48\! drawable-mdpi/appicon.png && \
convert appicon.png -resize 36x36\! drawable-ldpi/appicon.png
@GregPK
GregPK / gist:2768a6f952dd5aa40afd
Created October 30, 2014 11:16
Stepmania crash log (actual)
StepMania v5.0 beta 4a crash report (build 0, 20141029 @ 10:32:04 PM CET (UTC+01:00))
--------------------------------------
Architecture: Unix
Crash reason: Segmentation fault - address not mapped at 0x0000000000000004
Crashed thread: Main thread
Checkpoints:
Thread: Main thread
Profile.cpp:1626
@GregPK
GregPK / gist:5eadbae83bca4f24add6
Created October 29, 2014 21:52
Stepmania crash log
StepMania v5.0 beta 4a
Compiled 20141029 @ 10:32:04 PM CET (UTC+01:00) (build 0)
Log starting 2014-10-29 22:50:53
Xlib: extension "RANDR" missing on display ":0".
Loading window: gtk
OS: Linux ver 030500
Crash backtrace component: x86 custom backtrace
Crash lookup component: dladdr
Crash demangle component: cxa_demangle
Runtime library: glibc 2.15
# A Guardfile for use with nodeschool (http://nodeschool.io/)
# (part 1 - learnyounode)
# verify solution when any js.file changed
guard :shell do
watch(/(.*).js/) {|m| `learnyounode verify #{m[0]}` }
end
@GregPK
GregPK / loadtempmon.sh
Created September 26, 2013 08:28
Simple load and temperature monitor for my HTPC box. Originally used to measure efficiency of GPU drivers (integrated into the CPU) and the noise they make (fan speed)
#!/bin/bash
while [ true ]; do
echo -n `date '+%Y-%m-%d_%H:%M:%S'` ;
echo -n ' ';
awk '{print $1,$2,$3}' /proc/loadavg | tr -d '\n';
echo -n ' ';
sensors | grep fan1 | tr -d '\n' | awk '{printf $2}';
echo -n ' ';
sensors | grep temp1 -m 1 | tr -d '\n' | awk '{gsub(/[C°\+\^]/,"")}; {printf $2}';
echo -n ' ';