Skip to content

Instantly share code, notes, and snippets.

View lukaszkorecki's full-sized avatar
🌴
🛹

Łukasz Korecki lukaszkorecki

🌴
🛹
View GitHub Profile
@jcyamo
jcyamo / i3-exit
Last active October 9, 2020 10:26
Exit script for the i3 window manager based off of exit script from CrunchBang Linux.
#!/usr/bin/env python
# based on cb-exit used in CrunchBang Linux <http://crunchbanglinux.org/>
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
@embolalia
embolalia / gist:5660363
Last active December 17, 2015 19:29
A quick script that makes my raspi light up for different ping times. It's a terrible hack, and was not written with the intent of making it public. Please don't hurt me.
#!/usr/bin/env python
import RPi.GPIO as gpio
from time import sleep
import re
import sys
gpio.setmode(gpio.BCM)
red = 23
yel = 24
@timcowlishaw
timcowlishaw / monads.rb
Created April 26, 2013 16:19
A Ruby approximation of the Continuation Monad from Haskell, inspired by Dan Piponi's FPComplete tutorial, "The Mother of All Monads": https://www.fpcomplete.com/user/dpiponi/the-mother-of-all-monads
# Inspired by https://www.fpcomplete.com/user/dpiponi/the-mother-of-all-monads, A ruby port of Haskell's continuation monad, using fibers for lazily-evaluated giggles:
#
# For reference, The continuation monad instance definition from haskell:
# instance Monad (Cont r) where
# return a = Cont ($ a)
# m >>= k = Cont $ \c -> runCont m $ \a -> runCont (k a) c
#HI THERE, I AM THE CONTINUATION MONAD
class Cont
def self.unit(x)

Given this:

export PATH=.bundle/bin:$PATH

Autocompleting of binaries from $PWD/.bundle/bin works in bash but not in zsh.

Given this:

export PATH=/proc/self/cwd/.bundle/bin:$PATH
@paneq
paneq / page.conf
Created April 3, 2013 14:57
nginx maintenance page that is JSON friendly
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
internal;
if ($http_accept ~ json) {
return 503 "{}";
}

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

#!/usr/bin/env python -tt
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os, os.path
import sys
import re
from pprint import pprint, pformat
import json
@robotslave
robotslave / gist:4633393
Last active February 6, 2021 12:22
How to get Emoji in your Ubuntu Terminal
<!--
1. Download the Android Jelly Bean fonts and the Symbola font:
https://www.dropbox.com/s/tvtzcnzkvbe0nrt/jelly-bean-fonts.zip
http://users.teilar.gr/~g1951d/Symbola707.zip
2. unzip the files and put AndroidEmoji.ttf and Symbola.ttf (and any of the other fonts that strike your fancy)
in your ~/.fonts/ directory
3. run `fc-cache -f`. You can check to make sure the new fonts
were installed with `fc-list`. You'll probably want to grep the copious output for Symbola or Emoji
#create a test index with shingle mapping
curl -XPUT localhost:9200/test -d '{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_shingle":{
"tokenizer":"standard",
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"]
}
@ptaoussanis
ptaoussanis / declare-remote.clj
Created December 31, 2012 09:21
Make forward declarations in any namespace to circumvent circular dependency limitations.
(defmacro declare-remote
"Declares the given ns-qualified names, preserving symbol metadata. Useful for
circular dependencies."
[& names]
`(do ~@(map (fn [n]
(let [ns (namespace n)
v (name n)
m (meta n)]
`(do (in-ns '~(symbol ns))
(declare ~(with-meta (symbol v) m))))) names)