Skip to content

Instantly share code, notes, and snippets.

View Turupawn's full-sized avatar
🇭🇳
Karaoke veteran

Ahmed Castro Turupawn

🇭🇳
Karaoke veteran
View GitHub Profile
@Turupawn
Turupawn / gist:96cac22337d165b885e3b19a028c2de1
Created July 16, 2020 22:48
pgsearch custom dictionary & configuration
# 1. Create config
CREATE TEXT SEARCH CONFIGURATION public.my_config ( COPY = pg_catalog.spanish );
# 2. Create dictionary
CREATE TEXT SEARCH DICTIONARY public.my_dict ( TEMPLATE = pg_catalog.simple, STOPWORDS = russian);
# 3. Alter config
ALTER TEXT SEARCH CONFIGURATION public.my_config ALTER MAPPING FOR asciiword, asciihword, hword_asciipart, hword, hword_part, word WITH my_dict;
# 4. ????
{
"id": "cus_HgmX89nEIYSwXA",
"object": "customer",
"address": null,
"balance": 0,
"created": 1595351372,
"currency": "hnl",
"default_source": "card_1H7Oy7Cg28Y4yaQ4apG3yFRY",
"delinquent": false,
"description": null,
cd /etc/postgresql/11/main
nano pg_hba.conf
service postgresql restart
pg_dump -U postgres -W -F t TodoLegalDB_Production --verbose > /root/dump.tar
name: Itch.io release
on:
release:
types: [published]
jobs:
upload:
runs-on: ubuntu-latest
steps:
@Turupawn
Turupawn / gist:cb3c407aee775a34a3839b4971d72a00
Created September 12, 2020 04:36
[borrame] npm install error shy panda
turupawn@userr:~/Projects/ShyPanda$ npm install
> [email protected] preinstall /home/turupawn/Projects/ShyPanda/node_modules/scrypt
> node node-scrypt-preinstall.js
> [email protected] install /home/turupawn/Projects/ShyPanda/node_modules/scrypt
> node-gyp rebuild
make: Entering directory '/home/turupawn/Projects/ShyPanda/node_modules/scrypt/build'
# Gemfile
```
gem 'devise'
gem 'simple_token_authentication'
```
```
bundle install
rails generate devise:install
rails generate devise User
pragma solidity ^0.8.0;
contract HackathonMunon
{
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function add8(uint32 a, uint32 b) internal pure returns (uint32) {
return a + b;
pragma solidity 0.7.4;
contract YourContract {
enum Choice { Rock, Paper, Scissors }
uint256 public challenge_count = 0;
mapping(uint256 => address payable) public challenger_addresses;
mapping(uint256 => address payable) public challenged_addresses;
mapping(uint256 => uint256) public bets;
mapping(uint256 => Choice) private challenger_choices;
mapping(uint256 => Choice) private challenged_choices;
@Turupawn
Turupawn / revert_tx_reason.js
Created May 9, 2021 00:21
revert transaction reason
async function getRevertReason(txHash){
const tx = await web3.eth.getTransaction(txHash)
var result = await web3.eth.call(tx, tx.blockNumber)
result = result.startsWith('0x') ? result : `0x${result}`
if (result && result.substr(138)) {
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
contract MyContract {
string public hello;
constructor()
{
hello = "Hola mundo!";