Skip to content

Instantly share code, notes, and snippets.

View GitHub30's full-sized avatar
🌴
On vacation

GitHub30

🌴
On vacation
  • Osaka, Japan
View GitHub Profile
@GitHub30
GitHub30 / decryptchromecookies.py
Last active April 4, 2024 09:08
Simple Decrypt Chrome/Firefox Cookies File (Python 3) - Windows
import sqlite3
def get_chrome_cookies(db=None):
import json
from base64 import b64decode
from win32.win32crypt import CryptUnprotectData # pip install pywin32
# should use Cryptodome in windows instead of Crypto
# otherwise will raise an import error
from Cryptodome.Cipher.AES import new, MODE_GCM # pip install pycryptodomex
<?php
// .phpファイルをアップロードできないように
function sanitize($filename) {
$allowed_extensions = [
'jpg',
'jpeg',
'png',
'txt',
'html',
cd
VERSION=$(php -r 'echo phpversion();')
wget https://www.php.net/distributions/php-$VERSION.tar.gz
tar xf php-$VERSION.tar.gz
cd php-$VERSION/ext/exif
phpize
./configure
make
echo n | make test
make install
cd
VERSION=$(php -r 'echo phpversion();')
wget https://www.php.net/distributions/php-$VERSION.tar.gz
tar xf php-$VERSION.tar.gz
cd php-$VERSION/ext/pdo_mysql
phpize
./configure
make
make test
make install
// ==UserScript==
// @name 新しいスクリプト 421815
// @version 1
// @match https://wiki.greasespot.net/GM.xmlHttpRequest
// @match http://example.com/
// @grant GM.xmlHttpRequest
// ==/UserScript==
function get(url) {
return new Promise(resolve => {
const days = 365
const urls = ['', ...[...Array(days).keys()].map(i=>i+1).map(i=>new Date(Date.now() - 1000*60*60*24*i).toLocaleDateString('sv').replaceAll('-', '')).map(d => '/' + d)].map(path => 'https://b.hatena.ne.jp/hotentry/it' + path)
const htmls = await Promise.all(urls.map(url => fetch(url).then(r=>r.text())))
const docs = htmls.map(html => new DOMParser().parseFromString(html,'text/html'))
function countAndSort(arr) {
return Object.entries(arr.reduce((prev, curr) => (prev[curr] = ++prev[curr] || 1, prev), {})).sort((a,b) => b[1]-a[1])
}
@GitHub30
GitHub30 / get_random_bytes.js
Created May 8, 2023 10:55 — forked from alexdiliberto/get_random_bytes.js
Get random bytes in Javascript (Browser/Node)
let getRandomBytes = (
(typeof self !== 'undefined' && (self.crypto || self.msCrypto))
? function() { // Browsers
var crypto = (self.crypto || self.msCrypto), QUOTA = 65536;
return function(n) {
var a = new Uint8Array(n);
for (var i = 0; i < n; i += QUOTA) {
crypto.getRandomValues(a.subarray(i, i + Math.min(n - i, QUOTA)));
}
return a;
sudo dnf install -y net-tools libnsl nano wget \
&& curl -LO https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.0/xampp-linux-x64-8.2.0-0-installer.run \
&& chmod +x xampp-linux-x64-8.2.0-0-installer.run \
&& sudo ./xampp-linux-x64-8.2.0-0-installer.run --mode unattended \
&& echo 'PATH="/opt/lampp/bin:$PATH"' >> ~/.bashrc \
&& source ~/.bashrc \
&& sudo /opt/lampp/lampp start
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
We can't make this file beautiful and searchable because it's too large.
news,type
"China had role in Yukos split-up
China lent Russia $6bn (£3.2bn) to help the Russian government renationalise the key Yuganskneftegas unit of oil group Yukos, it has been revealed.
The Kremlin said on Tuesday that the $6bn which Russian state bank VEB lent state-owned Rosneft to help buy Yugansk in turn came from Chinese banks. The revelation came as the Russian government said Rosneft had signed a long-term oil supply deal with China. The deal sees Rosneft receive $6bn in credits from China's CNPC.
According to Russian newspaper Vedomosti, these credits would be used to pay off the loans Rosneft received to finance the purchase of Yugansk. Reports said CNPC had been offered 20% of Yugansk in return for providing finance but the company opted for a long-term oil supply deal instead. Analysts said one factor that might have influenced the Chinese decision was the possibility of litigation from Yukos, Yugansk's former owner, if CNPC had become a shareholder. Rosneft and VEB declined to comme
# https://github.com/dbrgn/coverage-badge/blob/ea399fc586eb00ec7f77e355a2e4b2b7cebd24c1/tests/test_output.py#L49
p=$(printf %.0f $(grep -Pom1 '(?<=aria-valuenow=").*?(?=")' reports/index.html))
color=$([[ $p -gt 96 ]] && echo 4c1 || ([[ $p -gt 92 ]] && echo 97CA00 || ([[ $p -gt 79 ]] && echo a4a61d || ([[ $p -gt 64 ]] && echo dfb317 || ([[ $p -gt 44 ]] && echo fe7d37 || ([[ $p -gt 14 ]] && echo e05d44 || echo 9f9f9f))))))
wget -O reports/badge.svg https://shields.io/badge/coverage-$p%25-$color?logo=github