Skip to content

Instantly share code, notes, and snippets.

@buptxge
buptxge / print_with_win32print.py
Created April 7, 2016 08:38
Print image using win32print and PIL
View print_with_win32print.py
import win32print
import win32ui
from PIL import Image, ImageWin
PHYSICALWIDTH = 110
PHYSICALHEIGHT = 111
printer_name = win32print.GetDefaultPrinter ()
file_name = "new.jpg"
@themojilla
themojilla / countries.js
Last active June 14, 2023 05:00
لیست کامل کشورهای جهان - json
View countries.js
export default [
{ name: 'Afghanistan', code: 'AF', name_fa: 'افغانستان' },
{ name: 'land Islands', code: 'AX', name_fa: 'جزایر الند' },
{ name: 'Albania', code: 'AL', name_fa: 'آلبانی' },
{ name: 'Algeria', code: 'DZ', name_fa: 'الجزایر' },
{ name: 'American Samoa', code: 'AS', name_fa: 'ساموآی آمریکا' },
{ name: 'AndorrA', code: 'AD', name_fa: 'آندورا' },
{ name: 'Angola', code: 'AO', name_fa: 'آنگولا' },
{ name: 'Anguilla', code: 'AI', name_fa: 'آنگویلا' },
{ name: 'Antigua and Barbuda', code: 'AG', name_fa: 'آنتیگوآ و باربودا' },
@rafaelpadovezi
rafaelpadovezi / git-bash-fish.md
Last active June 14, 2023 04:59
Using fish shell with git bash on windows
View git-bash-fish.md

Using fish shell with git bash on windows

To install fish shell on windows the options are:

  • Cygwin
  • WSL
  • MSYS2

Since git bash is based on MSYS2 it seems a good fit to install fish. The problem is that git bash is a lightweight version of MSYS2 which does not include pacman as a package management, used to install fish.

This OS thread has great suggestions on how to solve this problem including using the full MSYS2. But the best solution for me was this answer by Michael Chen which installs pacman on git bash.

@megrxu
megrxu / client-config.json
Last active June 14, 2023 04:53
v2ray | WebSocket + VMess/VLess + TLS
View client-config.json
{
"inbounds": [
{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": false
}
}
@liujoey
liujoey / java.lua
Last active June 14, 2023 04:52
nvim-jdtls settings
View java.lua
local status_ok, jdtls = pcall(require, "jdtls")
if not status_ok then
return
end
-- Determine OS
local home = vim.env.HOME
local launcher_path =
vim.fn.glob(home .. "/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar")
if #launcher_path == 0 then
@ragul28
ragul28 / webhook_install.sh
Created May 18, 2020 17:01
Easy webhook installation script to systemd.
View webhook_install.sh
#!/bin/bash
echo "[-] Installing webhook.."
wget https://github.com/adnanh/webhook/releases/download/2.6.11/webhook-linux-amd64.tar.gz
tar -xvf webhook*.tar.gz
sudo mv webhook-linux-amd64/webhook /usr/local/bin
rm -rf webhook-linux-amd64*
echo "[ok] Installing webhook."
@mccabe615
mccabe615 / phpdangerousfuncs.md
Last active June 14, 2023 04:53
Dangerous PHP Functions
View phpdangerousfuncs.md

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec - Executes a program
@ag-michael
ag-michael / FalconHuntqueries.md
Last active June 14, 2023 04:48
Falcon hunt queries
View FalconHuntqueries.md

timestamp convert:


 convert ctime(timestamp/1000)

.top,.club,.xyz,.ru domain lookups where the amount of lookup for the domain is more than 1 and less than 4 per computer


aid=* event_simpleName=DnsRequest | regex DomainName=".*\.top$|.*\.club$|.*\.xyz$|.*\.ru$|[0-9]+.*\.\w$" | stats values(ComputerName) count by DomainName| where count <4 | sort – count
@bartholomej
bartholomej / css-media-queries-cheat-sheet.css
Last active June 14, 2023 04:48
CSS Media Query Cheat Sheet (with Foundation)
View css-media-queries-cheat-sheet.css
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@kylehughes
kylehughes / TornRectangle.swift
Last active June 14, 2023 04:48
A rectangle shape for SwiftUI that can render any edge like a torn piece of paper.
View TornRectangle.swift
// Copyright 2021 Kyle Hughes
//
// 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:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
// Software.
//