Skip to content

Instantly share code, notes, and snippets.

View notcod's full-sized avatar
💭
I may be slow to respond.

notcod

💭
I may be slow to respond.
View GitHub Profile
import hashlib
import binascii
def hashIt(firstTxHash, secondTxHash):
# Reverse inputs before and after hashing
# due to big-endian
unhex_reverse_first = binascii.unhexlify(firstTxHash)[::-1]
unhex_reverse_second = binascii.unhexlify(secondTxHash)[::-1]
concat_inputs = unhex_reverse_first+unhex_reverse_second
@notcod
notcod / auto_git_file.md
Created December 30, 2022 22:08 — forked from darencard/auto_git_file.md
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@notcod
notcod / header_http_status_codes.php
Created February 17, 2023 18:48 — forked from phoenixg/header_http_status_codes.php
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(
<VirtualHost *:80>
ServerName default.example.com
Redirect permanent / https://default.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@default.example.com
ServerName default.example.com
DocumentRoot /var/www/default
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@notcod
notcod / addven.sh
Last active February 19, 2023 16:22
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi
if [ -f "/etc/apache2/sites-available/$1.conf" ]
then
echo "File exist!"
else
@notcod
notcod / delven.sh
Last active February 19, 2023 16:22
#!/bin/bash
if [ -f "/etc/apache2/sites-available/$1.conf" ]
then
a2dissite $1.conf > /dev/null 2>&1
rm /etc/apache2/sites-available/$1.conf
rm -rf /var/www/$1
rm /etc/apache2/ssl/$1.pem
rm /etc/apache2/ssl/$1.key
else
echo "File is not found"
<?php
<?php
///amo integra begin
$values = $hook->getValues();
$subject = $modx->getOption('emailSubject', $formit->config, 'form-'.$modx->resource->get('emailSubject'));
$name = $values['name'];
$phone = $values['phone'];
$email = $values['email'];
@notcod
notcod / gist:79219f7339c7197bbe77ddc715f8bca2
Created August 6, 2023 11:05 — forked from stereokai/gist:36dc0095b9d24ce93b045e2ddc60d7a0
CSS rounded corners with gradient border
.rounded-corners-gradient-borders {
width: 300px;
height: 80px;
border: double 4px transparent;
border-radius: 80px;
background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff);
background-origin: border-box;
background-clip: padding-box, border-box;
}
import {
component$,
Slot,
useStyles$,
} from "@builder.io/qwik";
import { Link, routeLoader$, useLocation } from "@builder.io/qwik-city";
import type { RequestHandler, LinkProps } from "@builder.io/qwik-city";
import Header from "~/components/starter/header/header";
import Footer from "~/components/starter/footer/footer";
import { $ } from "@builder.io/qwik";
import type { RequestEventAction } from "@builder.io/qwik-city";
import { server$ } from "@builder.io/qwik-city";
interface CookieOption {
[key: string]: string;
}
interface Cookie {
name: string | undefined;
value: string | undefined;
options: CookieOption[] | undefined;