Skip to content

Instantly share code, notes, and snippets.

Avatar
🧪
why has the new github hidden statuses?

Qais Patankar qaisjp

🧪
why has the new github hidden statuses?
View GitHub Profile
@mabako
mabako / decode.lua
Created Jun 28, 2012
lua € thing, unicode(like utf16)->utf8
View decode.lua
:gsub("&#%d%d%d%d;", decode)
function decode(str)
local num = tonumber(str:sub(3,6))
local first = math.floor(num/4096)
num = num - 4096 * first
return string.char(first+224, math.floor(num/64)+128, num%64+128)
end
View .bashrc
# use zsh instead of bash
case $- in
*i*)
if [ $(which zsh 2>/dev/null) ]; then
export SHELL=$(which zsh)
export BASH=""
exec zsh
fi
esac
@tiimgreen
tiimgreen / app.rb
Created Apr 12, 2014
A simple Ruby program.
View app.rb
puts 'Hello World'
@kubasz
kubasz / sums.sh
Last active Nov 30, 2017
Checksums of program outputs
View sums.sh
#!/bin/bash
# To run you need to:
# * Have compiled mem_sim.c to mem_sim in the same folder
# * Have mem_trace.txt in the same folder as this script
# * Save the script as sums.sh
# * Run: chmod +x sums.sh
# * Run: ./sums.sh
declare -A checksums
@nkcmr
nkcmr / proposal.md
Last active Jul 17, 2019
Informal Golang Proposal: `catch` block as an alternative to `if err != nil`
View proposal.md

Informal Golang Proposal: catch block as an alternative to if err != nil

PLEASE NOTE: I am not a language designer or have any experience in implementing or mainting a language or compiler. So, I would love to write out the EBNF syntax for what I am about to propose, but alas, I wouldn't know where to start. So, please forgive the informal nature of the proposal and feel free to ask questions; hopefully I'll be able to keep up with actual experts in this field and if not I apologize for my naivety in advance!

When the try() proposal was closed, I was relieved. There is a problem to be solved here, but try, to me at least, created more problems while trying to solve one.

The main problems, I think it created were the following:

  • try reduced the visiblility of failures. For example:
@dufferzafar
dufferzafar / allah-and-gsoc-irc-chat.txt
Last active May 18, 2020
"Allah & GSoC" - an excerpt from #gsoc IRC channel.
View allah-and-gsoc-irc-chat.txt
[6:48 pm] <Guest25582> http://oortr.com/YmU5NT
[6:48 pm] <valorie> rather than pasting a random link, why not say what it is, Guest25582?
[6:48 pm] <Guest25582> Allah is doing
[6:48 pm] <Guest25582> sun is not doing Allah is doing
[6:48 pm] <Guest25582> moon is not doing Allah is doing
[6:48 pm] <meflin> this channel is about GSOC
[6:48 pm] <Guest25582> stars are not doing Allah is doing
[6:48 pm] <valorie> please stay on topic or leave, Guest25582
[6:48 pm] <Guest25582> planets are not doing Allah is doing
[6:48 pm] <valorie> pfff
View misleading-cat.cpp
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@jambu
jambu / gmail-scrollbars.css
Created Mar 9, 2012 — forked from Cifro/gmail-scrollbars.css
New Gmail like scrollbars for webkit browsers
View gmail-scrollbars.css
/* Gmail style scrollbar */
::-webkit-scrollbar {
width: 12px
}
::-webkit-scrollbar-thumb {
border-width: 1px 1px 1px 2px
}
::-webkit-scrollbar-track {
border-width: 0
}
@yougg
yougg / detectrun.go
Created Jun 20, 2019
Detect if windows golang executable file is running via double click or from cmd/shell terminator
View detectrun.go
// +build windows
//go:generate go build -ldflags "-s -w -extldflags '-static'" $GOFILE
package main
import (
"fmt"
"syscall"
"unsafe"
)
@datagrok
datagrok / vendoring.md
Last active Feb 10, 2021
"Vendoring" is a vile anti-pattern
View vendoring.md

"Vendoring" is a vile anti-pattern

What is "vendoring"?

From a comment on StackOverflow:

Vendoring is the moving of all 3rd party items such as plugins, gems and even rails into the /vendor directory. This is one method for ensuring that all files are deployed to the production server the same as the dev environment.

The activity described above, on its own, is fine. It merely describes the deployment location for various resources in an application.