Skip to content

Instantly share code, notes, and snippets.

View cemk's full-sized avatar
🎨
Look ma, no code!

Cem K. cemk

🎨
Look ma, no code!
View GitHub Profile
@cemk
cemk / keybase.md
Created January 23, 2018 19:43
keybase.md

Keybase proof

I hereby claim:

  • I am cemk on github.
  • I am cemk (https://keybase.io/cemk) on keybase.
  • I have a public key ASA3Y1vRIDOqXo8WX7n89pCCzbTTj5Po4ZaaeJ4rpNswvgo

To claim this, I am signing this object:

@cemk
cemk / all-to-try.5m.rb
Last active November 25, 2018 16:43
BitBar için döviz kuru göstergesi. Doviz.com API erişimini engellediği için canlidoviz.com'dan çekiyor verileri.
#!/usr/bin/env ruby
# <bitbar.title>Çoklu Döviz Kontrolü</bitbar.title>
# <bitbar.version>5.285</bitbar.version>
require 'open-uri'
require 'json'
begin
#!/bin/bash
# Get your token from DuckDNS.org
TOKEN="YOUR-TOKEN-HERE"
# Your domains as a list.
domains=("DOMAIN1" "DOMAIN2")
# Let the code do its thing.
LOCALIP="$(ifconfig wlan0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)"
echo "Local IP: $LOCALIP"
@cemk
cemk / zzzz-localip.sh
Last active April 28, 2016 15:13
This bash script gets your devices local IPv4 and sets it to your zzzz.io domains. (My usecase: I carry around a Raspberry Pi for web development, and can set multiple domains in one line so I can continue testing no matter what network or device I'm on.)
#!/bin/bash
# Get your token from zzzz.io
ZZZZ_TOKEN="YOUR-TOKEN-HERE"
# Your domains as a list.
domains=("DOMAIN1" "DOMAIN2")
# Let the code do its thing.
LOCALIP="$(ifconfig wlan0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)"
echo "Local IP: $LOCALIP"
start on runlevel [2345]
stop on runlevel [016]
respawn
setuid {User}
setgid {User}
script
cd /home/{User}
@cemk
cemk / Caddyfile
Created January 26, 2016 17:41
Caddyfile for Kirbydrop
[DomainName] {
root [RootFolder]/
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp .*
ext /
to /index.php/{uri}
}
var http = require('http');
var url = require('url');
function expand() {
var short = url.parse('http://t.co/wbDrgquZ');
var options = {
host: short.hostname,
port: 80,
@cemk
cemk / linebreak.py
Created October 29, 2011 14:52
Creating linebreaks and paragraphs in Jinja2/Flask à la Django Style
import re
from jinja2 import evalcontextfilter, Markup, escape
@app.template_filter()
@evalcontextfilter
def linebreaks(eval_ctx, value):
"""Converts newlines into <p> and <br />s."""
value = re.sub(r'\r\n|\r|\n', '\n', value) # normalize newlines
paras = re.split('\n{2,}', value)