This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# DJango field type for a Bitcoin Address | |
# | |
import re | |
from django import forms | |
from django.forms.util import ValidationError | |
from Crypto.Hash import SHA256 | |
class BCAddressField(forms.CharField): | |
default_error_messages = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest' | |
class BitcoinAddressValidator < ActiveModel::EachValidator | |
def validate(record, field, value) | |
unless valid_bitcoin_address?(value) | |
record.errors[field] << "Bitcoin address is invalid" | |
end | |
end | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Security.Cryptography; | |
using NUnit.Framework; | |
namespace BitcoinValidator | |
{ | |
public class ValidateTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import hashlib | |
BASE58 = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
def Candidate(): | |
""" | |
Generate a random, well-formed mini private key. | |
""" | |
return('%s%s' % ('S', ''.join( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"country_code": "TG", | |
"lang_code": "ee", | |
"lang_name": "Ewe", | |
"country_name": "Togo", | |
"lang_native": "Eʋegbe" | |
}, | |
{ | |
"country_code": "KE", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE CountryTemp( | |
country_code NVARCHAR(4) NOT NULL | |
,lang_code NVARCHAR(3) NOT NULL | |
,lang_name NVARCHAR(12) NOT NULL | |
,country_name NVARCHAR(36) NOT NULL | |
,lang_native NVARCHAR(18) | |
); | |
INSERT INTO CountryTemp(country_code,lang_code,lang_name,country_name,lang_native) VALUES (N'TG',N'ee',N'Ewe',N'Togo',N'Eʋegbe'); | |
INSERT INTO CountryTemp(country_code,lang_code,lang_name,country_name,lang_native) VALUES (N'KE',N'kam',N'Kamba',N'Kenya',NULL); | |
INSERT INTO CountryTemp(country_code,lang_code,lang_name,country_name,lang_native) VALUES (N'HN',N'es',N'Spanish',N'Honduras',N'español'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIViewController { | |
func topMostViewController() -> UIViewController { | |
if let presented = self.presentedViewController { | |
return presented.topMostViewController() | |
} | |
if let navigation = self as? UINavigationController { | |
return navigation.visibleViewController?.topMostViewController() ?? navigation | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Application; | |
import android.util.Log; | |
import android.arch.lifecycle.*; | |
public class App extends Application implements LifecycleObserver { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
ProcessLifecycleOwner.get().getLifecycle().addObserver(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Activity getActivity() { | |
try { | |
Class activityThreadClass = Class.forName("android.app.ActivityThread"); | |
Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null); | |
Field activitiesField = activityThreadClass.getDeclaredField("mActivities"); | |
activitiesField.setAccessible(true); | |
Map<Object, Object> activities = (Map<Object, Object>) activitiesField.get(activityThread); | |
if (activities == null) | |
return null; |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [EMLAK_HANEM] | |
GO | |
/****** Object: Table [dbo].[IL] Script Date: 1/21/2020 4:05:09 PM ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE TABLE [dbo].[IL]( | |
[id] [int] IDENTITY(1,1) NOT NULL, | |
[adi] [nvarchar](50) NOT NULL, |