Skip to content

Instantly share code, notes, and snippets.

View dungsaga's full-sized avatar
👻
ghost in the machine

DungSaga dungsaga

👻
ghost in the machine
View GitHub Profile
@dungsaga
dungsaga / math.sql
Last active December 28, 2015 09:50
obfuscated sql queries
select abs(ceil(round(sin(6)*sin(4)*sin(2)*sin(0)))) = abs(ceil(round(sin(7)*sin(5)*sin(3)*sin(1))))
;
select right(left(right(left(right(left('select',6),5),4),3),2),1)
;
select right(left(right(left(right(left(right(left(right(left(right(left(right(left(right(left(right(left(right(left('select',20),19),18),17),16),15),14),13),12),11),10),9),8),7),6),5),4),3),2),1)
;
@dungsaga
dungsaga / document.cookie-is-empty.js
Last active February 5, 2016 08:43
reproduce bug "document.cookie is empty if any cookie has non-ASCII characters" (https://code.google.com/p/chromium/issues/detail?id=485035)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Chrome bug 530121</title>
<meta name="viewport" content="initial-scale=1">
</head>
<body>
<div style="transform:scaleX(1); box-shadow:0 0 75px rgba(0,0,0,0.65);" >
<div style="overflow:scroll; height:300px;" >
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@dungsaga
dungsaga / fix-zimbra-web-client-in-chrome.md
Last active July 11, 2018 09:16
fix "narrow columns" of Zimbra web client in Google Chrome v45

There's a problem when viewing Zimbra web client in Google Chrome v45: The user interface does not fill the whole width of the browser window.

While waiting for Zimbra and Chrome to fix it, we can use this workaround:

  1. open Chrome DevTools (with Ctrl+Shift+J or Command+Option+J)
  2. run this command: $("#skin_td_main").setAttribute('style', 'width: 88%')
  3. close Chrome DevTools (with F12)

Screenshots:

@dungsaga
dungsaga / README.md
Created March 17, 2019 23:29
Candlestick chart demo
@dungsaga
dungsaga / README.md
Last active March 18, 2019 02:35
Line chart with tag cloud
@dungsaga
dungsaga / route.sh
Last active January 14, 2020 05:59
Access remote host via a specific network interface
#!/bin/bash
# SSH can access a remote host using a specified network interface
# just use -b with local address of that network interface
ssh -b 10.20.30.40 root@12.34.56.78
# add a route to a remote host via a specified network interface
sudo ip route add 12.34.56.0/24 via 40.30.20.10 dev wlp2s0
# delete a route in the routing table
sudo ip route delete 12.34.56.0/24
// use the web page at http://marlot.org/util/calcul-de-la-cle-nir.php
// when you input the data, it will calculate the check digits (Clé de contrôle)
// ref: https://en.wikipedia.org/wiki/INSEE_code
// run this in console to get the NIR string:
v=ids=>ids.split(',').map(id=>(e=document.getElementById(id),e.value||e.textContent)).join(' ');
v('sexe,annee,mois,dept,commune,ordre,cle');
// or, patch function CalculerCleNir in http://marlot.org/util/js/global.js
// line 149: cle.innerHTML=calculCle;
@dungsaga
dungsaga / st4-changelog.md
Last active July 14, 2020 07:26 — forked from jfcherng/st4-changelog.md
Sublime Text 4 changelog just because it's not on the official website yet.