Skip to content

Instantly share code, notes, and snippets.

@Fighter19
Fighter19 / steamcon.c
Last active October 23, 2016 04:19
Accessing the Steam Controller through libusb; Attempt of reversing the protocol.
//Do what you want with this example
//Author: Fighter19
//Comment: I used Wireshark to get most of the values
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@alastairparagas
alastairparagas / TripleIntegralsCylindricalSpherical.ipynb
Last active November 12, 2016 22:25
Triple Integral Plotting in iPython
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// copied from rustdoc
/// Parses, resolves, and typechecks the given crate
fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<~str>) -> (ast::Crate, CrateAnalysis) {
use syntax::codemap::dummy_spanned;
use rustc::driver::driver::{FileInput, build_configuration,
phase_1_parse_input,
phase_2_configure_and_expand,
phase_3_run_analysis_passes};
let input = FileInput(cpath.clone());
@ynsta
ynsta / json2vdf.py
Last active September 25, 2017 22:03
Steam vdf/json converters
#!/usr/bin/env python
import json
def json2vdf(stream):
"""
Read a json file and return a string in Steam vdf format
"""
@SinBirb
SinBirb / check_darkmode.js
Created October 26, 2017 16:37
Heuristic to check whether a site appears dark or bright to a user
/* round num to c digits */
function round(num, c) {
return +(Math.round(num + "e+" + c) + "e-" + c);
}
/* Adapted from Python from manojpandey, thanks!
https://gist.github.com/manojpandey/f5ece715132c572c80421febebaf66ae
*/
function rgbTolab(inputColor) {
@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@i2000s
i2000s / jekyll-tikz.rb
Created November 4, 2017 09:12 — forked from AlexBobkov/jekyll-tikz.rb
Jekyll-tikz is a Jekyll plugin which helps you use Tikz in you Jekyll site.
# Authored my Maxfan http://github.com/Maxfan-zone http://maxfan.org
# This is used to convert tikz code into svg file and load in you jekyll site
#
# Install:
#
# 1. Copy this file in your _plugins/ directory. You can customize it, of course.
# 2. Make sure texlive and pdf2svg are installed on your computer.
# 3. Set path to pdf2svg in _config.yml in "pdf2svg" variable
#
# Input:
@lipp
lipp / client.lua
Created May 23, 2013 10:34
luasec non block example based on luasec/sample/want (dont forget to generate certs from luasec/sample/certs!) start like this: $ lua server_ev.lua & $ lua client.lua & $ lua client.lua & $ lua handshake.lua &
--
-- Test the conn:want() function
--
-- Public domain
--
require("socket")
require("ssl")
local params = {
mode = "client",
@AmrEldib
AmrEldib / git.lua
Created February 29, 2016 05:33
Customize Windows Cmder Prompt
---
-- Find out current branch
-- @return {false|git branch name}
---
function get_git_branch()
for line in io.popen("git branch 2>nul"):lines() do
local m = line:match("%* (.+)$")
if m then
return m
end
@igniteflow
igniteflow / rename.py
Created September 19, 2011 16:41
Python script to rename files in directory, transforming spaces to hyphens and the chars to lowercase
import os
"""
Renames the filenames within the same directory to be Unix friendly
(1) Changes spaces to hyphens
(2) Makes lowercase (not a Unix requirement, just looks better ;)
Usage:
python rename.py
"""