Skip to content

Instantly share code, notes, and snippets.

View thlorenz's full-sized avatar
👁️
{ this.props.status }

Thorsten Lorenz thlorenz

👁️
{ this.props.status }
View GitHub Profile
@MightyPork
MightyPork / custom-serde.rs
Created June 11, 2019 20:34
example of custom serialize and deserialize in serde
use serde::ser::SerializeMap;
use serde::{Serialize, Serializer, de::Visitor, de::MapAccess, Deserialize, Deserializer};
use std::fmt;
#[derive(Debug)]
struct Custom(String, u32);
impl Serialize for Custom {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@watson
watson / bisect.sh
Last active January 27, 2022 10:55
Automated git bisect to find breaking commit in Node core. This example was used to find a specific issue, so it should of course be modified to fit your needs. These files are ment to be put inside the root of your locally cloned node repo.
#!/usr/bin/env bash
# This script is an easy way to bisect between two releases of Node.js
if [ $# -ne 2 ]; then
echo "Error: No arguments supplied!"
echo "Usage:"
echo " ./bisect.sh <git-ref> <git-ref>"
echo
echo "Example:"
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active March 27, 2024 02:55 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@krtx
krtx / imgcat
Created November 27, 2016 02:48
fix imgcat to be able to display images on tmux https://gitlab.com/gnachman/iterm2/issues/3898#note_14097715
#!/bin/bash
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST.
function print_osc() {
if [[ -n $TERM ]] ; then
printf "\033Ptmux;\033\033]"
else
printf "\033]"
@Pencroff
Pencroff / CamelCaseMacro.velocity
Last active January 30, 2024 12:56
Transformation file name to CamelCase in IntelliJ IDEA file templates
## file name transformation
## file-name => FileName
## Sources:
## http://stackoverflow.com/questions/6998412/velocity-string-function
## http://stackoverflow.com/questions/21288687/using-velocity-split-to-split-a-string-into-an-array-doesnt-seem-to-work
## http://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/util/StringUtils.html#split(java.lang.String, java.lang.String)
#set( $CamelCaseName = "" )
#set( $part = "" )
@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active December 24, 2023 05:25
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@defunctzombie
defunctzombie / browser.md
Last active August 1, 2023 14:23
browser field spec for package.json
@AndreasMadsen
AndreasMadsen / WhatIHaveDone.md
Last active February 13, 2022 16:15
Playing with smartos
@TooTallNate
TooTallNate / repl-client.js
Created March 26, 2012 20:09
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)