Skip to content

Instantly share code, notes, and snippets.

View dpedu's full-sized avatar

Dave Pedu dpedu

View GitHub Profile
@depp
depp / problem.cpp
Last active December 21, 2021 19:04
A Faster Solution
// Faster solution for:
// http://www.boyter.org/2017/03/golang-solution-faster-equivalent-java-solution/
// With threading.
// g++ -std=c++11 -Wall -Wextra -O3 -pthread
// On my computer (i5-6600K 3.50 GHz 4 cores), takes about ~160 ms after the CPU
// has warmed up, or ~80 ms if the CPU is cold (due to Turbo Boost).
// How it works: Start by generating a list of losing states -- states where the
// game can end in one turn. Generate a new list of states by running the game
@wido
wido / dnskey_to_dsrecord.py
Created July 18, 2016 11:58
Calculate DS record from DNSKEY with Python 3
"""
Generate a DNSSEC DS record based on the incoming DNSKEY record
The DNSKEY can be found using for example 'dig':
$ dig DNSKEY secure.widodh.nl
The output can then be parsed with the following code to generate a DS record
for in the parent DNS zone
@blakev
blakev / background_tasks.py
Last active October 19, 2017 21:10
Background tasks manager for gevent Greenlets
#!/usr/bin/env python3
# ~*~ coding: utf-8 ~*~
#
# >>
# .. created: 5/20/16
# .. author: blake.vandemerwe
#
# LICENSE
# <<
@hetima
hetima / file1.markdown
Last active January 22, 2018 08:51
How to transition from EasySIMBL to SIMBL

#How to transition from EasySIMBL to SIMBL

( ~ is your home directory )

  1. Launch EasySIMBL.app. Turn OFF Use SIMBL checkbox. Quit EasySIMBL.
  2. Remove ~/Library/ScriptingAdditions/EasySIMBL.osax if exists.
  3. SIMBL directory and EasySIMBL.osax located in ~/Library/Containers/ is not needed. Find from Finder or find command like find ~/Library/Containers -name "*SIMBL*" -ls and remove manually if exists.
  4. Restart Mac (just in case).
  5. Install SIMBL-0.9.9 (original SIMBL-0.9.9.pkg is not code signed. So open from context menu)
  6. Done.
@vasilisp
vasilisp / preseed.cfg
Created February 16, 2015 09:53
Preseeding for a sane Debian installation
d-i passwd/root-login boolean false
d-i base-installer/install-recommends boolean false
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i popularity-contest/participate boolean false
d-i preseed/late_command string in-target apt-get install --purge -y sysvinit-core
@itod
itod / fluidapp_default_prefs.txt
Last active November 21, 2016 03:15
Altering FluidApp default user preferences
This should be possible by cracking open Fluid.app (Fluid itself, not Fluid apps you create, mind you), and editing this config file:
Fluid.app/Contents/Resources/FluidApp.app/Contents/Resources/FluidApp-DefaultValues.plist
All of the default user defaults (aka user preferences) are stored here. Subsequent Fluid Apps created by this Fluid.app instance will have these default preferences.
@adamsdesk
adamsdesk / gist:2c1faa68a6b28a261a85
Created July 9, 2014 16:18
How to Create a Custom USB Debian Installer
This custom installer assumes to use the Debian Wheezy 32-bit/AMD 64-bit.
Example of preseed file http://www.debian.org/releases/stable/example-preseed.txt.
- Plug the USB flash drive into a Linux based system.
- # sudo blkid
* Note the device name for the USB flash drive to be used in the next step.
- Use gParted or fdisk or cfdisk to create the following on the USB flash drive.
- Create as: Primary Partition
- Free space preceding (MIB): 1
- Free space following (MIB): 0
@whiteinge
whiteinge / eventlisten.sh
Last active August 30, 2017 18:37
A POSIX sh implementation of Salt's eventlisten.py script. Uses salt-api's event HTTP stream.
#!/bin/sh
URL="http://localhost:8000"
COOKIES="cookies.txt"
fnmatch () { case "$2" in $1) return 0 ;; *) return 1 ;; esac ; }
listen() {
# Watch Salt's events HTTP stream.
@hitsumabushi
hitsumabushi / default
Last active September 21, 2020 09:12
Preseed Files : working with Wheezy & Ubuntu 14.04
# D-I config version 2.0
default debian/7.4/amd64/boot-screens/vesamenu.c32
prompt 1
timeout 300
menu title - Boop Menu -
label Debian-7.4
menu label ^0 Debian 7.4
#include debian/7.4/amd64/boot-screens/menu.cfg
kernel debian/7.4/amd64/linux
#element{
background-image: url('/images/sprite.png');
background-repeat: no-repeat;
background-position: -3px 0;
}
@media (min--moz-device-pixel-ratio: 1.25),
(-webkit-min-device-pixel-ratio: 1.25),
(min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx) {