Skip to content

Instantly share code, notes, and snippets.

View 1player's full-sized avatar
💥

Stéphane Travostino 1player

💥
View GitHub Profile
@1player
1player / counterstats.clj
Last active August 29, 2015 14:05
counterstats
(ns counterstats-clj.core
(:gen-class)
(:require [clj-http.client :as client]
[cheshire.core :refer :all]))
(def steam-key "XXX")
(def csgo-appid "730")
(def steam-profile "76561198005221932")
(defn flatten-steam-stats [stats]
@1player
1player / term.go
Created December 18, 2014 09:45
Get terminal size from Go
package main
import (
"fmt"
"os"
"syscall"
"time"
"unsafe"
)
#!/bin/sh
# Cero3 Shaper
# A 3 bin tc_codel and ipv6 enabled shaping script for
# ethernet gateways
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
defmodule Crawlerex do
@url "http://lib.colostate.edu/wildlife/atoz.php?letter=ALL"
@fname "/tmp/animals.html"
def download do
%HTTPoison.Response{body: body} = HTTPoison.get! @url
File.write! @fname, body
end
def run do
defmodule Character do
use GraphQL.ObjectInterface
field :id, null: false
field :name
field :friends, type: List.of(Character)
field :appearsIn, type: List.of(Episode)
end
defmodule Human do
@1player
1player / empty_pop3_account.py
Created September 7, 2012 10:29
Empty a POP3 account
#!/usr/bin/env python
import sys
import getpass
import poplib
if len(sys.argv) != 3:
print("{0} <POP3 host> <username>".format(sys.argv[0]))
sys.exit(1)
@1player
1player / dining_philosophers.go
Created June 27, 2013 18:31
Playing with the Dining Philosophers problem and Go..
package main
import (
"fmt"
"os"
"os/signal"
"time"
)
const n = 5
@1player
1player / clear-with-esc.html
Last active March 20, 2016 11:24
Angular directive to clear a form input with the ESC key
<input type="text" ng-model="searchQuery" clear-with-esc>
@1player
1player / simple-bwlimit.qos.patch
Last active March 20, 2019 19:23
OpenWRT SQM script for bandwidth limited class
--- simple.qos
+++ simple-bwlimit.qos
@@ -77,6 +77,7 @@
BE_RATE=`expr $CEIL / 6` # Min for best effort
BK_RATE=`expr $CEIL / 6` # Min for background
BE_CEIL=`expr $CEIL - 16` # A little slop at the top
+BL_RATE=`expr $CEIL / 100`
LQ="quantum `get_mtu $IFACE $CEIL`"
defmodule XXX.Schema.Middleware.FieldACL do
@behaviour Absinthe.Middleware
def call(resolution, {_field, nil}) do
resolution
end
def call(resolution, {field, public_fields}) do
logged_in? = Map.get(resolution.context, :current_user) != nil