Skip to content

Instantly share code, notes, and snippets.

@xl1
xl1 / gist:940d653451fd96a06618a6df08d5df84
Last active May 31, 2022 05:29
PDF に謎の漢字が含まれるとき

PDF に謎の漢字が含まれるとき

PDF などの中にある一部の日本語の漢字が、見た目は同じだけど異なる謎の文字に変換されていることがある

@yidas
yidas / js-nl2br-br2nl.md
Last active September 29, 2023 05:26
JavaScript nl2br & br2nl functions

JavaScript nl2br & br2nl functions

The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.

These JavaScript functions consider whether to use insert or replace to handle the swap.

nl2br

@taurus227
taurus227 / !Git hooks for NPM projects
Last active July 26, 2022 20:49 — forked from betorobson/post-checkout
git hook to run `npm install` after git pull, merge, rebase or checkout if package.json was changed
# The name for this gist (starts with exclamation mark, because the name of the gist is the name of the first file in ASCIIbetical order)
@guilhermepontes
guilhermepontes / shuffle.js
Last active October 29, 2023 01:41
Shuffle Array - JavaScript ES2015, ES6
// original gist
const shuffleArray = arr => arr.sort(() => Math.random() - 0.5);
// fully random by @BetonMAN
const shuffleArray = arr => arr
.map(a => [Math.random(), a])
.sort((a, b) => a[0] - b[0])
.map(a => a[1]);
shuffleArray([1, 2, 3]) //[3, 1, 2]
@bhickey
bhickey / gist:0de228c02cc60b5965582d2d946d8c38
Created February 5, 2017 17:57
6502 xorshift, 8-bit full period
; r ^= (r << 1)
; r ^= (r >> 1)
; r ^= (r << 2)
xorshift:
lda <RAND_SEED
asl a
eor <RAND_SEED
tax
asr a
@goldhand
goldhand / parseHtmlStyles.js
Last active March 18, 2023 16:28
Parse html style string for a react component
/**
* @function parseStyles
* Parses a string of inline styles into a javascript object with casing for react
*
* @param {string} styles
* @returns {Object}
*/
const parseStyles = styles => styles
.split(';')
.filter(style => style.split(':')[0] && style.split(':')[1])
@lokhman
lokhman / ubuntu-hardening.md
Last active April 23, 2024 09:05
List of things for hardening Ubuntu

WARNING

May contain out of date information. Check the comments below!

The list of actions listed below was taken mostly from Book Of Zeus with minor modifications and did the job well for Ubuntu version, which was available at that moment (May 2016). This gist was created for internal use and was never meant to be discovered by the web, although Google managed to find and index this page, which was a great surprise for me. Please check the original source for the updated information (links are provided in most of the sections), and read the comments below: they provide more details about the usage experience.

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.

@shokai
shokai / ignore.sh
Created July 7, 2012 13:58
放送禁止用語リスト
curl http://monoroch.net/kinshi/kinshi.csv | nkf -u | grep '^"' | ruby -lane 'puts $_.split(/,/)[0].scan(/"(.+)"/)[0]' | sort | uniq