Skip to content

Instantly share code, notes, and snippets.

View junkblocker's full-sized avatar

Manpreet Singh junkblocker

View GitHub Profile
@icholy
icholy / map_filter_reduce.go
Last active February 20, 2017 01:44
chaining channels in go
package main
import (
"unicode/utf8"
)
type Item string
type Stream chan Item
type Acc string
augroup VCSCommand
autocmd!
autocmd User VCSBufferCreated call s:vcscommand_buffer_settings()
augroup END
function! s:vcscommand_buffer_settings() "{{{3
if !exists('b:VCSCommandCommand') | return | endif
if b:VCSCommandCommand !=# 'commitlog' | setlocal readonly | endif
if b:VCSCommandCommand !=# 'vimdiff' | setlocal nofoldenable | endif
if &filetype ==# 'gitlog' | setlocal syntax=git | endif
@deris
deris / open_neobundlepath2.vim
Created July 4, 2013 17:31
NeoBundleの相対パスを開く(operator-user対応)
NeoBundle 'tyru/open-browser'
NeoBundle 'kana/vim-operator-user'
call operator#user#define('open-neobundlepath', 'OpenNeoBundlePath')
map gz <Plug>(operator-open-neobundlepath)
function! OpenNeoBundlePath(motion_wise)
if line("'[") != line("']")
return
endif
let start = col("'[") - 1
@rofl0r
rofl0r / init.c
Created August 6, 2013 21:15
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@ahmozkya
ahmozkya / README.md
Last active July 7, 2023 09:27
Homebrew with DNSMasq + DNSCrypt-proxy (OpenDNS)
@ethanmick
ethanmick / 2048.applescript
Last active August 29, 2015 13:57
A script to play 2048 on Chrome.
activate application "Google Chrome"
delay 1.0 -- time to release modifier keys if the script is run with a keyboard shortcut
tell application "System Events"
repeat 100 times
set rand to (random number from 123 to 126)
key code rand
delay 0.2
end repeat
end tell
@aznn
aznn / gist:9482114
Created March 11, 2014 09:11
Greedy Algorithm for 2048
/**
* Copy paste in the console, then restart the game (space bar)
*
* Greedy Algorithm for : http://gabrielecirulli.github.io/2048/
* Plays the game using a naive greedy method. i.e. Local maximum
*
* Azaan
*/
(function () {
var __restart = GameManager.prototype.restart;
@garaud
garaud / pipe-to-emacs.py
Last active October 3, 2023 13:11
Pipe to Emacs: Insert a result from an UNIX command into a new Emacs buffer
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Damien Garaud
# Date: 2014-2015
# License: Simplified BSD
"""Allow you to pipe command results into an Emacs buffer. Suppose you have an
Emacs server since you launch 'emacsclient'.
@tarruda
tarruda / snake.py
Last active June 11, 2021 00:01
snake.py
# Snake for Neovim! Adapted from https://gist.github.com/sanchitgangwar/2158084
# To install, create a ~/.vim/rplugin/python/snake.py file with this
# code, then run `nvim -c 'UpdateRemotePlugins' -c 'q'` from a shell.
#
# Make sure you have read the internal help explaining how to setup python
# host for external plugins(:help nvim-python)
#
# To start a new game, use the `:SnakeStart` command on an empty buffer(uses 80
# columns and 20 rows)
from threading import Thread, Lock
@denji
denji / golang-tls.md
Last active May 18, 2024 16:33 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)