Skip to content

Instantly share code, notes, and snippets.

@shakna-israel
shakna-israel / LetsDestroyC.md
Created January 30, 2020 03:50
Let's Destroy C

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


@romainl
romainl / redir.md
Last active July 9, 2024 16:26
Redirect the output of a Vim or external command into a scratch buffer

Redirect the output of a Vim or external command into a scratch buffer

Usage (any shell)

Show full output of command :hi in scratch window:

:Redir hi

Show full output of command :!ls -al in scratch window:

@dixudx
dixudx / StreamToString.go
Created November 16, 2016 09:34 — forked from tejainece/StreamToString.go
Golang: io.Reader stream to string or byte slice
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@ygotthilf
ygotthilf / jwtRS256.sh
Last active July 28, 2024 08:52
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@dapangmao
dapangmao / bb1.txt
Last active January 1, 2020 01:34
Bloomberg 全体展览
【===========算法============】
【*****leetcode/lintcode*****】
same tree, Binary tree inorder iterator, inorder & postorder traverse BST, binary tree level order traversal(print指定level的binary tree), tree upside down, add next to every tree node, Convert Sorted Array to BST, binary tree的maxSumPath, reverse linkedlist, linkedlist输出倒数K个node的值, linked list取中值, linked list做减法/加法(反序), valid BST, linkedlist找merge point, copy linkedlist with random pointer, flatten BST to linkedlist(把BST替换为2Dlinkedlist,本质不变), depth, interseciton of linked list(一个一步一个多步是否可以(复杂度高)) LRUCache, upside down, recover binary tree from inorder and preorder,
word search I, min stack, stock transaction I(buy date is needed) & II, two sum, subset, unique paths II, merge two/k sorted array/linked list, Find kth largest number(quickselect, array partition), sort colors, remove duplicate from a sorted array, search in sorted rotated array(binary search), search for a range and delete it in array, next permutation, find peak element(一个先降后升的数组,怎么在这个数组中找到
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active July 31, 2024 05:53
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@danesparza
danesparza / negroni-gorilla.go
Last active December 16, 2020 12:36
Negroni with Gorilla mux subrouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"log"
"net/http"
)
@ipedrazas
ipedrazas / knife cheat
Last active December 13, 2021 11:50
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway